Skip to content

Fixup KToolBarPopupAction

Kai Uwe Broulik requested to merge work/kbroulik/ktoolbarpopupaction-enum into master

Restore popupMenu()

Using menu() will make the action have a submenu when placed in a menu, which exactly counteracts the raison d'etre for this class.

Instead, the popupMenu() is to be used so that the menu only shows up in a toolbar but nowhere else as intended.

Introduce own PopupType enum

Allows to have a "NoPopup" value so one can switch between a regular button and a button with a menu without swapping the entire QAction out.


This is a breaking change, as menu() will be null, so apps (like Dolphin) doing stuff like m_backAction->menu()->addAction() will crash, however, they will most likely crash on startup, so this is easily observed and fixed.

As for the PopupType, alternatively we could make a setPopupMenu so you can set a null menu?

See also kconfigwidgets!209 (merged) where I disable the popup if there are no recent files.

Edited by Kai Uwe Broulik

Merge request reports