[PyQt] Re: Troubles with PYQT.

Georg Altmann george at george-net.de
Wed Sep 17 11:21:37 BST 2008


Min Li schrieb:
> Hi everyone.
> 
> I have some trouble to retrieval the selected text in the QTextEdit. I mean
> I want use mouse to select the text in the QTextEdit, and retrieval it in a
> local variable.

Say your QTextEdit is te:

str = te.textCursor().selectedText()

Now str contains a QString with the selected text.

see
http://doc.trolltech.com/4.4/qtextedit.html#textCursor
http://doc.trolltech.com/4.4/qtextcursor.html#selectedText

Regards
Georg






More information about the PyQt mailing list