QStyle サブクラスを使用し、パレットを設定するアプローチは機能しません (ただし、他の基本スタイルに対しては機能しますMyStyle
)。
void MyStyle::drawControl(ControlElement control, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
{
switch(control)
{
case CE_ProgressBar:
{
const QStyleOptionProgressBarV2 * pOpts =
static_cast<const QStyleOptionProgressBarV2 *>(option);
QStyleOptionProgressBarV2 oOpts(*pOpts);
QColor progressColor(QColor::fromHsl(50, 160, 162));
oOpts.palette.setColor(QPalette::Highlight, progressColor);
// BASESTYLE is QMacStyle
BASESTYLE::drawControl(control, &outputOptions, painter, widget);
}
break;
default:
BASESTYLE::drawControl(control, option, painter, widget);
}
}
OS X でウィジェットの外観を制御する他の方法はありますか? (それとも完全に無理?)