Qt 样式表:如何将样式应用于菜单?如何去除 QTextEdit 周围的蓝色调?
我正在尝试将菜单栏设置为渐变黑色,并且效果很好,除了菜单标题之外。
这是我正在使用的样式表:
QString styleSheet = "QMenuBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray)} QStatusBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray);color:white;} ";
this->setStyleSheet(styleSheet);
- How do I apply the style to the meny headers?
QTextEdit
周围有一种我无法摆脱的蓝色调。有没有办法把它设置成黑色?
谢谢:)
I am trying to make the menubar a gradient black colour and that works fine, except for the menu headings.
Here's the stylesheet i'm using:
QString styleSheet = "QMenuBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray)} QStatusBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray);color:white;} ";
this->setStyleSheet(styleSheet);
- How do I apply the style to the meny headings too?
- There is a blue tinge all around the
QTextEdit
which I can't get rid of. Is there a way to set it to black?
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信以下网站是回答您所遇到的有关 QT
menubar
问题的良好资源:http://www.trinitydesktop.org/docs/qt4/stylesheet-examples.html#customizing-qmenubar
它给出了一些代码示例应充分解释您需要了解的内容。至于蓝色调,我不知道如何解决它 - 我还没有真正看到这种情况发生。
祝你好运。
I believe that the following website is a good resource for answering your question about the QT
menubar
issue you are having:http://www.trinitydesktop.org/docs/qt4/stylesheet-examples.html#customizing-qmenubar
It gives a few code samples which should fully explain what you need to know. As for the blue tinge, I do not have a good idea on how to fix it - I haven't really seen that happen.
Best of luck.
这为我解决了问题:
This solved the problem for me:
为标题应用颜色:
用于
QTextEdit
周围的蓝色调:for aply color to the headings:
For the blue tinge all around the
QTextEdit
:您可以尝试使用
QMenuBar::item{}
。You can try using
QMenuBar::item{}
.