Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set :hover on QMenu?

I'm working with QT and I have a menu. I have the follwing css for the menu:

QMenu {
   /* background-color: #0F7070;*/
    background-color:rgb(44,63,80);
    border-top: none;
    border-left:none;
    border-right:none;
    border-bottom:4px solid  rgb(44,205,112);;
    color:#fff;;
}

QMenu::item {
    spacing: 3px; /* spacing between menu bar items */
    padding: 10px 85px 10px 20px;
    background: transparent;
}
/*Does not work*/
QMenu::item:hover {
    background-color: rgb(52,73,94);
    border-top: none;
    border-left:none;
    border-bottom:none;
    border-left:3px solid  rgb(44,205,112);;
}

How can I set the :hover to the item? Thank you.

like image 845
Cthulhu Avatar asked Nov 02 '17 18:11

Cthulhu


1 Answers

I had same issue few years ago with a QT project. Even if it may look like conterintuitive i solved changing:

item:hover

to

item:selected

I was advised so on QT forum, in that contest :selected acted as :hover, i didn't get deeper in the question, maybe won't work, but it worth a try.

like image 83
holden Avatar answered Nov 15 '22 05:11

holden