[Qt-interest] Removing rollover effects from my QPlastiqueStyle derived style in Qt 4.5
John Moran
johnfrederickmoran at gmail.com
Thu Feb 25 15:23:10 CET 2010
Here's what I've come up with. Unfortunately, I must cast away const.
Although this seems to work fine on Qt for embedded linux, it's
probably ill-advised and non-portable:
void QMyCustomStyle::drawPrimitive(PrimitiveElement element,
const QStyleOption *option,
QPainter *painter,
const QWidget *widget) const
{
// remove rollover effects
if(option->state & State_MouseOver)
{
QStyleOption* sneekah = const_cast<QStyleOption *>(option);
sneekah->state &= ~State_MouseOver;
QPlastiqueStyle::drawPrimitive(element, sneekah, painter, widget);
return;
}
QPlastiqueStyle::drawPrimitive(element, option, painter, widget);
}
Does anyone have a better way?
Regards,
John Moran
More information about the Qt-interest-old
mailing list