Re: Menu palette question
Hi, welcome on board! ;)
Code:
QPalette p
= comboBox
->view
()->palette
();
comboBox->view()->setPalette(p);
Re: Menu palette question
Thank you. Unfortunately that didn't work. Neither did:
Code:
view->setPalette(palette);
I see a brief flash of the red only on the selected item. Then it goes back to the default. The menu itself (apart from the selected item) is not affected by the color choice.
I tried ::setColor with all the roles to no avail...
Any other pointers?
Thanks much.
Susan
Re: Menu palette question
Oh, you are running GNOME? Seems like it indeed doesn't work with the cleanlooks style.. Stylesheets introduced in 4.2 usually are a solution to palette problems, but even this doesn't work:
Code:
comboBox->setStyleSheet("QAbstractItemView { background: yellow }");
Feels like a bug to me.. :(
Re: Menu palette question
Yes I am running under gnome. The final product will be running without a window manager. I'll see how it works under KDE and study style sheets. I'll report back with my findings.
Re: Menu palette question
By the way, you can preview it with another style by passing a cmd line parameter:
Quote:
$ ./yourapp -style plastique
Re: Menu palette question
Yes I know, though that may not impact the settings under Gnome. I'll experiment a bit more and Thanks for all the help on this!
Re: Menu palette question
Under gnome, using the style sheet works; I was able to get it to work programatically using the ::setStyleSheet method and by reading an external .qss file.
So there is a bug using the palette. I also tried it under ICWM and found the same bug, so it may not be related to the desktop or window manager. Nevertheless, I'll submit a bug to Trolltech on the palette problem.
Thanks for the pointers, they really helped!
I am finding that I'll probably need to use a combination of style sheets and palettes because, for example, when you set the color of a QPushButton using the style sheet, you lose the Plastique look & feel (haven't tried it running under another L/F). But it works fine for QToolButton & QComboBox. I also noticed that I wasn't able to set the background color of tables or lists in style sheets either. But I'll continue working with it.
Re: Menu palette question - new problem!
So now I see another issue using the stylesheet for the combo box instead of QPalette. In the plastique style there is a "check" next to the selected item and it shouldn't be there in plastique. How would I make sure the L/F of the widget adheres to the platform style?