Results 1 to 2 of 2

Thread: QMenu styling

  1. #1
    Join Date
    Feb 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QMenu styling

    How can I add a margin before the first item in QMenu?

    "QMenu::item:first { margin-top: 50px; }" doesn't work.

    Neither does "QMenu { margin-top: 50px; }"

    "QMenu::item { margin-top: 50px; }" works, but obviously adds margin to all items, not only to the first one.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QMenu styling

    Untested, and I have no idea if it will work: You could check to see if the QMenu has a layout installed on it. If it does, you could try adjusting the contentsMargins property. If it doesn't have a layout, you could try installing one prior to adding items.

Similar Threads

  1. Problems when styling QMenu with Qt Stylesheet
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2011, 14:34
  2. Styling the tear-off handle of a QMenu?
    By dictoon in forum Qt Programming
    Replies: 2
    Last Post: 5th August 2010, 16:58
  3. Styling QComboBox
    By martinn in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2010, 20:55
  4. Styling QMenubar???
    By anupamgee in forum Qt Programming
    Replies: 5
    Last Post: 29th April 2009, 10:01
  5. Styling a QComboBox
    By Enygma in forum Qt Programming
    Replies: 6
    Last Post: 23rd August 2007, 10:22

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.