Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Is it possible to implement something like this?



  • This post is deleted!


  • I guess it is quite simple as tool buttons are made to have an optional menu in Qt. Have a look at the documentation for QToolButton. It has a funtion setMenu(QMenu*). I guess this is what you are looking for (I have never used this feature myself, so I am not entirely sure if this is the right function).

    If you are creating your toolbar from QActions, QAction also has a setMenu(QMenu*) function. I would assume it works the same if you add the action to the toolbar.


  • Moderators

    Yes, you can create a custom QWidget subclass for this (or maybe even a QMenu subclass).



  • I guess it is quite simple as tool buttons are made to have an optional menu in Qt. Have a look at the documentation for QToolButton. It has a funtion setMenu(QMenu*). I guess this is what you are looking for (I have never used this feature myself, so I am not entirely sure if this is the right function).

    If you are creating your toolbar from QActions, QAction also has a setMenu(QMenu*) function. I would assume it works the same if you add the action to the toolbar.


Log in to reply