Results 1 to 3 of 3

Thread: QComboBox with a view like a QMenu

  1. #1
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default QComboBox with a view like a QMenu

    Hi,

    I am trying to use a QComboBox and I would like it to function like a QMenu. I have multiple items in the list and a few of them have sub levels similar to a Menu. So I would like to hover or click on an Item and have the items show towards the left or right of the item I clicked on.

    So I would like to have something like
    Tools ->
    Help
    Preferences->


    where if i hover/click on tools a submenu comes up with cut/paste etc.

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    507
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox with a view like a QMenu

    Hi, you can subclass QComboBox and reimplement showPopup() to show the menu you like.

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    qtnewbi3 (22nd November 2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: QComboBox with a view like a QMenu

    Thanks for the reply, I have seen a couple of posts in my search regarding this and some people said that too many things in show popup are private and i would have to re-implement other stuff. Also, is there any example from which i can learn how to subclass showpopup.

    Edit:: I have decided to use QMenu and modify that to suit my needs... thanks
    Last edited by qtnewbi3; 22nd November 2011 at 15:14.

Similar Threads

  1. Changing properties of a QComboBox's list view
    By verigySupport in forum Qt Programming
    Replies: 0
    Last Post: 15th January 2011, 00:29
  2. Multible QCombobox tree with model view
    By mrandreas in forum Newbie
    Replies: 2
    Last Post: 22nd September 2010, 14:00
  3. Replies: 0
    Last Post: 5th January 2010, 13:14
  4. Qmenu as View in a QCombobox
    By tyrdal in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 10:04
  5. Replies: 1
    Last Post: 13th June 2008, 18:58

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.