[Qt] Caret problems

Павел Ишенин webpirat at mail.ru
Tue Jul 10 16:11:08 CEST 2007


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.

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.

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).

To draw on windget I am using this code:

        DC := TQtDeviceContext.Create(THandle(Self));
        SrcRect := Bounds(0, 0, Width, Height);
        DstRect := Bounds(X, Y - 1, Width, Height);
        DC.drawImage(@DstRect, AImage.Handle, @SrcRect);
        DC.Free;

What is more proper way to do this?

ps: you can test caret yourself. To do this apply patch, add SynEdit 
control to form, run application and press into synedit. You'll see what 
is wrong.

Best regards,
Paul Ishenin.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qt_caret.patch
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20070710/02d4624c/attachment-0001.ksh>


More information about the Qt mailing list