[Qt-creator] Drawing on QWidget
Coda Highland
coda at bobandgeorge.com
Mon Jul 6 02:37:04 CEST 2009
Qt3 supported painting on widgets outside of paintEvent(), but the
technique wasn't portable -- it didn't work on Mac at all, for
instance -- and it was difficult to cache the results for performance.
Qt4 has a flag that re-enables this old behavior for the sake of
porting old code, on supported platforms, but it's not recommended for
this reason.
Qt4's technique is overall cleaner by constraining painting operations
to a centralized point of access.
One thing to observe about Qt4 compared to other toolkits is that it
puts more emphasis on being consistent, correct, cleanly
object-oriented, and portable, even if it means there's a little bit
more work to do a few things that some other toolkits make easy. The
upshot of this is that in the end, due to these design goals, Qt makes
a lot of other things a lot more straightforward and elegant. It's a
serious development tool.
/s/ Adam
On 7/5/09, Alex Williams <linuxfpga at gmail.com> wrote:
>> I understand that this touches a fundamental problem of epistemology
>> but most people I am aware of distinguish between "I cannot observe it"
>> and "it does not exist". Those people might also be tempted to take
>> http://doc.trolltech.com/4.5/designer-using-custom-widgets.html as an
>> indication that your proposition is wrong.
>
> If something is not clear enough or hard to find = it's almost same as
> "it does not exists"... I did know that for such primitive action as
> drawing something - I nedd create widget...
>
>> This seems to use definition of 'analog/competitor' that I would not
>> actively use myself, but out of curiosity: How would that work with
>> wxWidgets?
>
> In wxWidgets everything is simple:
>
> void Draw(wxPanel *DS)
> {
> wxSize DC_Size;
> DC_Size = DS->GetSize();
> wxClientDC CDC(DS);
> wxBufferedDC DC(&CDC, DC_Size);
> wxBrush BackBrush(*wxWHITE);
> DC.SetBackground(BackBrush);
> DC.Clear();
> }
>
> that's all, no problems, no widgets, just paint on everything you want...
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
More information about the Qt-creator-old
mailing list