{
switch (control)
{
//replaces default CheckBox style with our own
case CE_CheckBox:
{
QRect frame
= newCheckBox.
rect;
painter->save();
painter->setBrushOrigin(frame.topLeft());
if(newCheckBox.state & State_MouseOver)
{
if(!checkbox->isChecked())
{
painter
->drawImage
(frame,
QImage("./Images/disabled_hover.png"));
}
else
{
//draw the color of the current module class
painter
->drawImage
(frame,
QImage("./Images/personal_enabled.png"));
}
}
else
{
if(!checkbox->isChecked())
{
painter
->drawImage
(frame,
QImage("./Images/disabled_default.png"));
}
else
{
//draw the color of the current module class
painter
->drawImage
(frame,
QImage("./Images/personal_enabled.png"));
}
}
painter->restore();
}
else
{
}
break;
void ResoStyle::drawControl(ControlElement control, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (control)
{
//replaces default CheckBox style with our own
case CE_CheckBox:
if(const QStyleOptionButton * checkOption = qstyleoption_cast<const QStyleOptionButton *>(option))
{
const QCheckBox * checkbox = qobject_cast<const QCheckBox *>(widget);
QStyleOptionButton newCheckBox(*checkOption);
QRect frame = newCheckBox.rect;
painter->save();
painter->setBrushOrigin(frame.topLeft());
if(newCheckBox.state & State_MouseOver)
{
if(!checkbox->isChecked())
{
painter->drawImage(frame, QImage("./Images/disabled_hover.png"));
}
else
{
//draw the color of the current module class
painter->drawImage(frame, QImage("./Images/personal_enabled.png"));
}
}
else
{
if(!checkbox->isChecked())
{
painter->drawImage(frame, QImage("./Images/disabled_default.png"));
}
else
{
//draw the color of the current module class
painter->drawImage(frame, QImage("./Images/personal_enabled.png"));
}
}
painter->restore();
QCleanlooksStyle::drawControl(control, &newCheckBox, painter, widget);
}
else
{
QCleanlooksStyle::drawControl(control, option, painter, widget);
}
break;
To copy to clipboard, switch view to plain text mode
Bookmarks