Spike Bughdaryan
Spike Bughdaryan

Reputation: 160

How to change Qmenubar item hover effect color in qt?

I have a QMenuBar in window, and background color is white, so when action is selected, or mouse is point at action, text color becomes white. How can i change hover effect color? I tried to change from pallete by changing selected text color, but that doesn't worked

No Action is selected

Mouse is pointing at Exit item

Upvotes: 0

Views: 2608

Answers (1)

Moia
Moia

Reputation: 2344

 QMenuBar::setStyleSheet()

will do the trick.

You can fully customize the layout of your component. Be aware of using setStyleSheet means you'll completely override the style of the component with your stylesheet.

QString style = "QMenuBar::item:selected { background: white; } QMenuBar::item:pressed {  background: white; }"

menuBar.setStyleSheet(style);

Upvotes: 3

Related Questions