Results 1 to 2 of 2

Thread: problem with QMenu::icon border

  1. #1
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default problem with QMenu::icon border

    Hi Everyone,

    I don't want any border for the icon of my QMenu but the border appears for the icon when an item gets selected. I am using the following stylesheet but it doesn't work:-

    Qt Code:
    1. setStyleSheet(QString::fromUtf8("QMenu\n"
    2. "{\n"
    3. "background: none;background-color: green;color:white;\n"
    4. "}\n"
    5. "QMenu::item:selected\n"
    6. "{ \n"
    7. "background-color: blue;\n"
    8. "}\n"
    9. "QMenu::icon:checked\n"
    10. "{ \n"
    11. "border: none;\n"
    12. "}"));
    To copy to clipboard, switch view to plain text mode 
    I tried to follow the examples given in http://harmattan-dev.nokia.com/docs/...tomizing-qmenu but it doesn't help. For the items which don't have focus the icons appear without any border. But for the selected item the icons come with a border . I would be glad if someone would help me with this.

    -thanks
    sattu
    Last edited by sattu; 20th May 2013 at 13:36.

  2. #2
    Join Date
    Oct 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with QMenu::icon border

    Hi!
    You can use something like this:


    Qt Code:
    1. setStyleSheet(QMenu::item:selected{border:none;});
    To copy to clipboard, switch view to plain text mode 

    but you also need to set item padding:

    Qt Code:
    1. setStyleSheet("QMenu::item{padding-left: (value here)px;}
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Style QMenu::item's icon
    By been_1990 in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2013, 14:59
  2. Icon in a QMenu doesn't show up on Linux
    By agarny in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2011, 14:58
  3. Replies: 1
    Last Post: 28th July 2010, 17:37
  4. Replies: 1
    Last Post: 24th May 2010, 11:57
  5. How to change Icon size in QMenu?
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 3rd September 2008, 14:16

Tags for this Thread

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.