6

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);
  1. How do I apply the style to the meny headings too?
  2. 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 :)

stylesheet not applied to menu items

4

4 に答える 4

5

次の Web サイトは、QT のmenubar問題に関する質問に回答するための優れたリソースであると思います。

http://www.trinitydesktop.org/docs/qt4/stylesheet-examples.html#customizing-qmenubar

知っておくべきことを完全に説明するいくつかのコードサンプルを提供します。青い色合いについては、それを修正する方法がよくわかりません。実際にそれが起こるのを見たことがありません。

幸運を祈ります。

于 2012-01-04T21:38:05.860 に答える
2

これで問題は解決しました:

QMenuBar::item {
    background-color: transparent;
}
于 2013-10-08T17:31:03.017 に答える
1

を使ってみることができますQMenuBar::item{}

于 2012-03-02T15:22:39.737 に答える