PDA

View Full Version : QComboBox with a view like a QMenu



qtnewbi3
21st November 2011, 16:59
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.

Ginsengelf
22nd November 2011, 07:01
Hi, you can subclass QComboBox and reimplement showPopup() to show the menu you like.

Ginsengelf

qtnewbi3
22nd November 2011, 13:43
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