On Tue, Jul 21, 2009 at 3:55 PM, HB<mszub...@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
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to