gpt4 book ai didi

c++ - 是否可以在 OS X 上重新设置 QProgressBar 的样式?

转载 作者:太空宇宙 更新时间:2023-11-04 14:19:47 24 4
gpt4 key购买 nike

使用 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 下小部件的外观? (或者完全不可能?)

最佳答案

当然,您可以使用 QSS , 请参阅 QProgressBar example

关于c++ - 是否可以在 OS X 上重新设置 QProgressBar 的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8538374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com