class CheckBoxStyleNoFocusDrawVista: public QWindowsVistaStyle{
public:
void drawControl
(ControlElement element,
const QStyleOption *opt,
{
switch (element) {
case CE_CheckBox:
subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget);
drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget);
subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget);
drawControl(CE_CheckBoxLabel, &subopt, p, widget);
}
break;
default:
QWindowsVistaStyle::drawControl(element, opt, p, widget);
}
}
};
setStyle(new CheckBoxStyleNoFocusDraw());
}
class CheckBoxStyleNoFocusDrawVista: public QWindowsVistaStyle{
public:
void drawControl(ControlElement element, const QStyleOption *opt,
QPainter *p, const QWidget *widget) const
{
switch (element) {
case CE_CheckBox:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget);
drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget);
subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget);
drawControl(CE_CheckBoxLabel, &subopt, p, widget);
}
break;
default:
QWindowsVistaStyle::drawControl(element, opt, p, widget);
}
}
};
void CheckBox1::CheckBox1():QCheckBox(){
setStyle(new CheckBoxStyleNoFocusDraw());
}
To copy to clipboard, switch view to plain text mode
Bookmarks