Qt Stylesheets: How to apply style to menus? How to remove blue tinge around QTextEdit?
-
12-04-2021 - |
Question
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 :)
Solution
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.
OTHER TIPS
This solved the problem for me:
QMenuBar::item {
background-color: transparent;
}
You can try using QMenuBar::item{}
.
for aply color to the headings:
QMenuBar::item{ background-color: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray) }
For the blue tinge all around the
QTextEdit
:QTextEdit{ border: 0 `
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow