This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Plasma::TextEdit without html formatting

Tags: None
(comma "," separated)
deadeyes
Registered Member
Posts
34
Karma
0
Hi all!

I wonder how I could get the contents from a TextEdit widget without the html formatting.

For QTextEdit there is a method, but not for TextEdit.

I need this because when I type something in the TextEdit field and I save and load it, it is saved as background black in the html formatting.
While I didn't set any background color.

Anyone knows how to fix this?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please see http://api.kde.org/4.x-api/kdelibs-apid ... 6472cf367a

KTextEdit is a subclass of QTextEdit.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
deadeyes
Registered Member
Posts
34
Karma
0
I have to say I do not have alot of experience in C++/Qt.

So should I use the object, call nativeWidget() and for that use acceptRichText, or autoFormatting?

Thanks!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The following code will disable the ability to set rich text.

Code: Select all
textEdit->nativeWidget()->setAcceptRichText( false );
textEdit->nativeWidget()->setAutoFormatting( QTextEdit::AutoNone );


This assumes your Plasma::TextEdit is called textEdit. Simply change textEdit as needed.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
deadeyes
Registered Member
Posts
34
Karma
0
bcooksley wrote:The following code will disable the ability to set rich text.

Code: Select all
textEdit->nativeWidget()->setAcceptRichText( false );
textEdit->nativeWidget()->setAutoFormatting( QTextEdit::AutoNone );


This assumes your Plasma::TextEdit is called textEdit. Simply change textEdit as needed.


Seems I guessed correct then.
That last part about the renaming I knew :)

Thanks alot!


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]