[Qt] Lazarus build problem is reported at russian forum

zeljko zeljko at holobit.net
Wed Jun 10 09:22:53 CEST 2009


On Wednesday 10 June 2009 09:09, Paul Ishenin wrote:
> zeljko wrote:
> > Fixed in  r20567
>
> Thanks.
>
> Btw, regards that code:
>
> procedure TQtWidget.InitializeWidget;
> begin
>    // default color roles
>    if InheritsFrom(TQtAbstractButton) then
> ...
>
> Why do you use InheritsFrom? Why not to call some virtual method and
> otherride it in TQtAbstractButton, TQtHintWindow, ...?

>
> Imo it is not a good way at all to compare in ancestor class inheritance
> from descendant and execute descendant code. And moreover various
> "InheritsFrom", "is", "as", '.ClassType = TSomeClass' links all that
> classes into executable even if they are not used in real.


I had big problems with MacOSX (lost at least 2 days with this problem) until 
discovered qt bugs, so I reduced patch size as much as I can, so I can better 
track what's up (the original patch contained code as I mention below - 
without any InheritsFrom() or ClassType=XXX).
Now when it works correct it can be refactored (that's the reason why we have 
WidgetColorRole & TextRole properties) - each widget creation MUST initialize 
it's own default WidgetRole & TextRole.
My general idea about palette rework is that default WidgetRole & TextRole 
should be in each CreateWidget() for widgets which aren't QPaletteWindow.



> Can you refactor this piece of code please?

yes




More information about the Qt mailing list