4

Is there a way to have multiple columns in a QMenu? I'm using Qt with C++. I have searched and there does not seem to be a way to do this built in to Qt. The question then is how do I add this functionality to my program? Has anyone built a custom menu that can have multiple columns?

Ben Gates
  • 762
  • 5
  • 14
  • 2
    How do you mean, multiple columns? Please elaborate and I think I may be able to help you. – Rob Jul 24 '12 at 14:22
  • 1
    @Rob I have a pop-up menu that is displayed when a button is clicked. I would like to have two columns in this menu instead of just one. It should look something like this: http://i.stack.imgur.com/YMSJd.png – Ben Gates Jul 28 '12 at 19:35
  • 1
    Sorry it took so long to get back, Ive been very busy but that is an interesting question. I have done a little research and I dont think you can out of the box without modifying anything, but im still looking. – Rob Aug 04 '12 at 02:53

1 Answers1

0

Maybe a submenu is what you're looking for. As qt doc says:

Separators are inserted with addSeparator(), submenus with addMenu(), and all other items are considered action items.

For example, here there is a full example. And "Format" menu item is a submenu. You can add a submenu with:

m_mysubmenu = QMenu(...);
...
m_menu->addMenu(m_mysubmenu);
Alberto
  • 718
  • 4
  • 20