[Qt-interest] Test if style implements PrimitiveElement

Jan janusius at gmx.net
Sun Jan 16 11:27:23 CET 2011


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





More information about the Qt-interest-old mailing list