[Qt-interest] Test if style implements PrimitiveElement
Bo Thorsen
bo at fioniasoftware.dk
Sun Jan 16 16:00:55 CET 2011
Den 16-01-2011 13:19, Jan skrev:
> Thank you Maximilian.
>
> I tried it, but option.rect returns a valid (correct) rect and type
> returns Frame with oxygen style.
Short answer: There is no way to do it.
Longer answer: There shouldn't be. The widgets just pass their state to
the style, and the style should handle it in the way it sees fit. It's
the proper separation of responsibilities.
Bo.
> Am 16.01.2011 11:58, schrieb Maximilian Hrabowski:
>> Hi,
>>
>> maybe querying the style for the size of the frame or use using pixelMetric would be sufficient for you - this should result in 0-sizes for your given case.
>>
>> Cheers,
>> Maxim
>>
>> ----- Original Message -----
>> From: Jan<janusius at gmx.net>
>> To: qt-interest at qt.nokia.com
>> Sent: Sun, 16 Jan 2011 11:27:23 +0100 (CET)
>> Subject: [Qt-interest] Test if style implements PrimitiveElement
>>
>> Hi,
>>
>> what is the best way (if any exists) to test if a QStyle implements a
>> PrimitiveElement?
>>
>> I have a custom widget where I do some drawing in paintEvent. I am also
>> drawing a frame :
>>
>> style()->drawPrimitive(QStyle::PE_Frame,&option,&painter, this);
>>
>> Unfortunately GTK+ and Oxygen styles do not draw any frames.
>>
>> Currently I am doing this to check the style in a changeEvent
>>
>> if (event->type() == QEvent::StyleChange)
>> mFrame = (QFrame::style()->metaObject()->className() !=
>> QString(aStyleClassName).toAscii());
>>
>> and if it is e.g. oxygen I am drawing a frame myself.
>>
>> Would be nicer if I could test if e.g. PE_FRAME is implemented.
>> Any ideas?
>>
>> Jan
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-interest-old
mailing list