The title says it all, I don't like the rubber band (that stroked rectangle you get around an item after you click it), so I subclassed QCommonStyle to override it:
{
public:
~MyListWidgetStyle () {}
{
switch(element)
{
case CE_FocusFrame: //surpressing these
case CE_RubberBand:
return;
default:
QApplication::style()->drawControl
(element, option, painter, widget
);
}
}
};
class MyListWidgetStyle : public QCommonStyle
{
public:
MyListWidgetStyle () : QCommonStyle() {}
~MyListWidgetStyle () {}
virtual void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = 0) const
{
switch(element)
{
case CE_FocusFrame: //surpressing these
case CE_RubberBand:
return;
default:
QApplication::style()->drawControl(element, option, painter, widget);
}
}
};
To copy to clipboard, switch view to plain text mode
And then in MyListWidget constructor's I call setStyle(new MyListWidgetStyle()). The only problem is that it doesn't do anything. In fact, drawControl is never called. What could be the reason for that? The only thing I could think of is that the application style isn't calling drawControl at all (which seems far-fetched, but okay), but when I override the entire application's style with this, it still doesn't work.
Any ideas or suggestions?
Bookmarks