Getting plain text from Plasma::TextEdit
Richard Dale
richard.j.dale at gmail.com
Tue Jul 21 17:32:13 CEST 2009
On Tue, Jul 21, 2009 at 3:55 PM, HB<mszubart at gmail.com> wrote:
> Thank you Richard.
> I wonder whether there is a possibility to get plain text from
> Plasma::TextEdit?
> As I see Plasma::TextEdit and Plasma::LineEdit are only 'text input'
> widgets.
> LineEdit isn't multiline, so is not suitable.
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
More information about the Plasma-devel
mailing list