有可能在OS X上重新设计QProgressBar吗?
Is it possible to re-style a QProgressBar on OS X?
使用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示例
相关文章:
- "ostream &os"有什么用?
- libprotobuf 检查在 Mac OS 上执行程序时失败
- C++读取用户输入而不按回车键(Mac OS X),与Turbo Pascal中的读取键相同
- 如何在 MAC OS c/c++ 中阻止 USB 存储设备
- 编译 Boost 时在 OS X 上的"ld:未知选项:-soname"
- 在 c++ 中检查 Windows OS 服务器版本
- OS X: ld: 找不到 -lstdc++ 的库
- Python os.system() 返回错误值
- Mac os x app bundle 在下载并运行时崩溃,但在终端或更改 Info.plist 时运行良好
- const 如何防止写入特定内存 [Clang, Mac OS]
- 旧C++代码中的目录查找导致 OS X Catalina 10.15 中的目录错误
- 如何在 Mac OS 上安装 boost-mpi 及其对 clang 的依赖关系?
- 在 Mac OS 中将 QT 与 CMAKE 集成
- Homebrew OS X OpenCV - 在另一台Mac上运行时寻找dylib
- 使用C/C++访问OS X密钥链
- 谷歌测试编译错误 Os X:函数式转换从"int"到"internal::FloatingEq2Matcher"的模糊转换<float>
- 从我的2d数组中的一列返回的字符串值被压缩为一个字符串(在Mac os上打开Windows txt文件)
- VK_ERROR_INCOMPATIBLE_DRIVER with Mac OS and Vulkan MoltenVK
- 根据比例更改 QProgressbar 块的颜色
- 有可能在OS X上重新设计QProgressBar吗?