[Qt] Caret problems

zeljko zeljko at holobit.net
Tue Jul 10 17:17:48 CEST 2007


On Tuesday 10 July 2007 16:11, Павел Ишенин wrote:
> Hello, Items specific to the Qt widget set
>
> I am trying to implement Caret functions like CreateCaret, DestroyCaret,
> ShowCaret, HideCaret. I looked at Qt classes and did not find apropriate
> methods to create caret. Yes, I can create control with caret but it is
> not the same. That functions mimics winapi. So I decided to implement
> Caret the same way as gtk widgetset do.

you're right , it's not so easy to get caret out of qt (think that QTextCursor 
is nearest class), so mimicked code is the only solution.

> Caret in gtk is 2 pixmaps that showing with interval (one pixmap
> contains bg and second caret). So I thinked it would be easy to achive
> same on qt.

There's implementation of TCaret for qt2 in QWindows unit of JVCL (CLX part),
and I think that it's maded by one pixmap (used for caret only) + timer.It's 
written by Andreas Hausladen some years ago.


>
> But I have problems.
>
> When I am trying to draw on widget it becomes gray and all other
> painting is dissapeared (maybe becase i do this on timer event and not
> on paint event).

definitelly, it must be painted inside paint event.

zeljko




More information about the Qt mailing list