Qt QMenu setting a stylesheet
I have a QMenu which I create like this.
QMenu *logoMenu = new QMenu();
I then add it to a QToolButton like so
logoButton->setMenu(logoMenu);
now I have an project.qss file which has the following stylesheet for the
QMenu
QMenu#logoMenu {
background-color: #161614; /* sets background of the menu */
border: 0px solid #161614;
width: 150px;
position: absolute;
top: 50px;
}
QMenu::item#logoMenu {
background-color: transparent;
}
QMenu::item:selected#logoMenu {
background-color: #202020;
}
My problem is that the stylesheet does NOT get applies to the QMenu, I
know I am loading the stylesheet correctly because I can style other
widgets.
If I set the stylesheet manually like so
logoMenu->setStyleSheet("QMenu {.....}");
It works, no problem. Does anyone know why this happens?
No comments:
Post a Comment