Results 1 to 2 of 2

Thread: QMenu: want a QListView in submenu to handle lots of options

  1. #1
    Join Date
    Jun 2008
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11
    Wiki edits
    1

    Question QMenu: want a QListView in submenu to handle lots of options

    One major down side to the QMenu class is if you need to add a lot of items to it, it begins to wrap around the screen if one column can't fit.

    In Qt3 I was able to relatively easily add a list view to a menu to solve this problem. If you get too many things in the menu it simply scrolls instead of adding another column. In Qt4 this seems to be far harder or at least elusive to me.

    The closest thing I can find that uses this in Qt4 is the QCompleter when showing a popup. However, it just shows a QAbstractItemView by setting its geometry and displaying it. I want to display a QListView in much the same way but as a submenu of a context menu but have no clue how to do it.

    ie:

    Qt Code:
    1. Cut Ctrl+X
    2. Copy Ctrl+C
    3. Paste Ctrl+V
    4. ---------
    5. Versions > // <-- this submenu would be a QListView with potentially a bunch of items in it
    To copy to clipboard, switch view to plain text mode 
    Any ideas?
    Last edited by chezifresh; 10th November 2009 at 23:28.

  2. #2
    Join Date
    Jun 2008
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11
    Wiki edits
    1

    Default Re: QMenu: want a QListView in submenu to handle lots of options

    Has anyone tried QWidgetAction with this? I can get the list view to show up but can never get the menu to disappear on click.

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.