[PyQt] Is it possible to override/extend QTextCursor?

Henning Schröder henning.schroeder at gmail.com
Sun Feb 8 21:52:12 GMT 2009


Hi!

On Sun, Jan 6, 2008 at 7:23 PM, Aaron Digulla <digulla at hepe.com> wrote:
> Hello,
>
> I tried to overload insertText() of QTextCursor like this:
>
> [..]
> but this test only outputs "x". I've checked the C++ source of Qt4 and
> it should call at least the methods defined above.
You have not read the C++ source of Qt4 correctly.

QTextEdit::append (see src/gui/widgets/qtextedit.cpp) calls
QTextControlPrivate::append (see src/gui/text/qtextcontrol.cpp). This
method uses a standard QTextCursor instance.

So it is not PyQt4's fault.

As far I understand QTextEdit::setTextCursor is only meant for making
selections and to position your visible cursor.

I have worked a lot with QTextEdit and I would suggest not to use
QTextEdit::append at all if you want to do some advanced stuff. If you
explain what you want to do, perhaps people could help you.


Henning


More information about the PyQt mailing list