how to change QCheckBox text label color in Qt?(如何在 Qt 中更改 QCheckBox 文本标签颜色?)
问题描述
我无法在 QT 中更改 Qcheckbox
的颜色,有人可以帮我编写代码来更改复选框文本标签的颜色.我试过 Qpalette
.. 而我使用的是 QT4.7.4 版本..
I'm unable to change the color of Qcheckbox
in QT, can somebody help me with code to change color of check box text label.
I have tried Qpalette
.. And im using QT4.7.4 version..
推荐答案
你可以使用 样式表.
例如:
checkBox->setStyleSheet("QCheckBox { color: red }");
有关详细信息,请查看 Qt 参考中的样式表 和样式表文档
For more details check the style sheets in Qt Reference and the stylesheets documentation
这篇关于如何在 Qt 中更改 QCheckBox 文本标签颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Qt 中更改 QCheckBox 文本标签颜色?


- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- C++ 协变模板 2021-01-01
- 近似搜索的工作原理 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07