Results 1 to 2 of 2

Thread: Background image on popup menu item

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Red face Background image on popup menu item

    How do I set background image on popup menu item? Can someone give me an example?
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Background image on popup menu item

    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.

    Qt Code:
    1. QPalette p = menu.palette();
    2. p.setBrush(QPalette::Button, QBrush(QPixmap("test.png")));
    3. menu.setPalette(p);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Replies: 6
    Last Post: 14th April 2006, 05:39
  2. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36
  3. Qt/MacOSX preferences menu item
    By mcenatie in forum Qt Programming
    Replies: 4
    Last Post: 14th March 2006, 04:24
  4. [QT4.1.1 XP] background image
    By incapacitant in forum Newbie
    Replies: 3
    Last Post: 1st March 2006, 13:02
  5. image for a custom menu Item.......
    By Naveen in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2006, 09:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.