PDA

View Full Version : Background image on popup menu item



MarkoSan
19th June 2006, 23:43
How do I set background image on popup menu item? Can someone give me an example?

jpn
27th June 2006, 06:55
I cannot say for sure about Qtopia 2.2.3, but you could try to play around with something like this. It all depends on the used style, of course. QPalette::Button color role could work with windows styles. Plastique style doesn't propably even use brushes at all when drawing a menu item so this doesn't work in case plastique style is in use. I suggest you to take a look at the style sources to find out how does it fill the background for a CE_MenuItem.



QPalette p = menu.palette();
p.setBrush(QPalette::Button, QBrush(QPixmap("test.png")));
menu.setPalette(p);