Results 1 to 3 of 3

Thread: Custom QMenu

  1. #1
    Join Date
    Nov 2009
    Posts
    22
    Thanks
    2

    Default Custom QMenu

    Greetings.

    QMenu lists its actions vertically, but I need a menu that lists actions vertically and horizontally (basically, you see a grid of actions when you click, say, File, and not just a list). I've subclassed QWidgetAction, but I can't figure out how to add them to the menu.

    I can't add a grid layout to the menu, so what is the proper way of doing this?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Custom QMenu

    Why did you subclass QWidgetAction and not QMenu? The former is for placing widgets in toolbars or menus. If you want a custom menu it would seem you should base on QMenu. On the other hand none of QMenu methods are virtual...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2009
    Posts
    22
    Thanks
    2

    Default Re: Custom QMenu

    I subclassed QWidgetAction because I need custom widgets for the actions, but we can ignore that part. Just think QAction objects.

    I did subclass QMenu, but I just can't figure out a way to do what I want. I can't just insert a grid layout into the menu, and there is no way to tell QMenu to have a minimum row count so that it wraps around and forms the next column.

    I think I'll have to subclass QWidget and design a custom menu.

Similar Threads

  1. Replies: 3
    Last Post: 10th December 2009, 22:53
  2. Replies: 12
    Last Post: 5th July 2009, 16:03
  3. QMenu popup: how close when clicked outside
    By powermax in forum Qt Programming
    Replies: 5
    Last Post: 4th March 2009, 03:18
  4. Replies: 2
    Last Post: 16th May 2008, 14:39
  5. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06

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
  •  
Qt is a trademark of The Qt Company.