[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Getting plain text from Plasma::TextEdit
From:       HB <mszubart () gmail ! com>
Date:       2009-07-21 16:11:48
Message-ID: 4A65E8C4.8040606 () gmail ! com
[Download RAW message or body]

Richard, thank you very much.

'nativeWidget'... That is so barefacedly obvious... My perceptivity is poor. :|


Thank you again.
I'm sorry for wasting your time.

---
Mateusz Szubart

> KTextEdit has a toPlainText method:
>
> $ rbqtapi -rkorundum4 -p KDE::TextEdit |grep -i plain
> void QTextEdit::insertPlainText(const QString&)
> void QTextEdit::setPlainText(const QString&)
> QString QTextEdit::toPlainText() const
> enum QFrame::Plain
>
> And it is the underlying nativeWidget for Plasma::TextEdit. So you can
> get at the plain text like this:
>
> require 'plasma_applet'
>
> module TestTextEdit
>   class Main < PlasmaScripting::Applet
>     slots :showText
>
>     def initialize(parent, args = nil)
>       super
>     end
>
>     def init
>       @text_edit = Plasma::TextEdit.new(self)
>       connect(@text_edit, SIGNAL(:textChanged), self, SLOT(:showText))
>     end
>
>     def showText
>       puts @text_edit.nativeWidget.toPlainText
>     end
>   end
> end
>
> -- Richard
>   

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic