On Thu, 31 Aug 2006 16:59:46 -0300
"Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I think I am very close to implementing TLabel on the Qt widgetset.
> 
> I just noted something wrong. I created a form with only 1 label and
> traced all qtwinapi calls on the software while it runs. DrawText
> function is only called once, with CalcRect flag set to true.
> 
> I repeated the test on Gtk widgetset and DrawText is called twice,
> once with CalcRect set, and another with CalcRect not set.
> 
> Any ideas what could cause this?
> 
> I see that the following chain of events occur:
> 
> 1 - GetDC is called once on software startup with hWnd = 0
> 
> 2 - The form is shown
> 
> 3 - GetDC is called again (this wouldn't happen without the label). A
> few font related functions are called, as well as DrawText with
> CalcRect set to True
> 
> 4 - The canvas is invalidated, what causes lclqt to send a message to
> Qt to update the canvas.
> 
> 5 - A message comes back from Qt telling us the form is being painted.
> 
> 6 - BeginPaint is called, and at this point code on OnPaint event of
> the form will be correctly executed and it's output will be shown.
> 
> Shouldn't DrawText be called again here??

Is labels TGraphicControl.WMPaint called?
Is Message.DC <> 0?
Add some debugln and test, what is called and what not.


> 
> 7 - The Painting ends.
> 
> Bellow is the full trace of all QtLCL calls on the software:
> 
> [EMAIL PROTECTED] test]$ ./setqttest
> [WinAPI GetDC] hWnd: 0
> TQtDeviceContext.Create ( WidgetHandle: 0 )
> [WinAPI ReleaseDC]
> TQtDeviceContext.Destroy
> TQtMainWindow.Create
> TQtWSWinControl.ShowHide Is TForm, Visible: False
> TQtWidget.SlotResize
> [WinAPI GetWindowRelativePosition]
> TQtWSWinControl.ShowHide Is TForm, Visible: True
> [WinAPI GetDC] hWnd: -1220879116
> TQtDeviceContext.Create ( WidgetHandle: 0 )
> [WinAPI CreateFontIndirect]
> TQtFont.Create
> Trace:> [WinAPI SelectObject] DC=-1220878316 GDIObj=-1220816364
> TQtFont.Create
> Trace:< [WinAPI SelectObject] Result=-1220816348 ObjectType=Font
> [WinAPI DrawText] DC: -1220878316 Str: Label1 CalcRect: True
> Trace:> [WinAPI SelectObject] DC=-1220878316 GDIObj=-1220816348
> TQtFont.Create
> Trace:< [WinAPI SelectObject] Result=-1220816300 ObjectType=Font
> [WinAPI ReleaseDC]
> TQtDeviceContext.Destroy
> [WinAPI Invalidate Rect]
> [WinAPI Invalidate Rect]
> TQtWidget.SlotPaint
> [WinAPI BeginPaint] Handle=-1220879116
> TQtDeviceContext.Create ( WidgetHandle: -1220879116 )
> Trace:> [WinAPI CreateBrushIndirect]  Style: 0, Color: 8000000F
> TQtBrush.Create
> Trace:< [WinAPI CreateBrushIndirect] Got --> B73BD274
> [WinAPI GetClientBounds]
> [WinAPI SetWindowOrgEx]
> Trace:> [WinAPI DeleteObject] GDIObject: 0
> Trace:< [WinAPI DeleteObject]
> [WinAPI SetWindowOrgEx]
> [WinAPI EndPaint] Handle: -1220879116 PS.HDC: -1220879052
> Freeing resources
> TQtDeviceContext.Destroy
> TQtMainWindow.Destroy
> 

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to