Is there a way to have multiple columns in a QMenu?
-
22-06-2021 - |
문제
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?
해결책 2
I found a way to do this here. This is not normally something that you want to do; there is usually a better way; but in my application, the user will be greatly helped by it.
다른 팁
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);