From 03e2ea2ac057b2b4aa1dc4e5b817ffd552080ce5 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Wed, 27 Feb 2013 17:11:41 +0100 Subject: Add convenience for section actions in QMenu Those actions are just separators having also text and potentially icon. It is very convenient to create titled sections in a menu, or give a title to a context menu. Obviously requires support for them on the style side, but modern styles like fusion or oxygen handle them just fine. For legacy styles it properly falls back to a regular separator aspect. That's why a specific style hint is also introduced. It is used by QMenu to know how the sections will be treated and take care of them correctly when eliminating duplicated separators or separators at the beginning of the menu. Change-Id: Iad00a93422b7983dc90dfc4b4b1c360122e47610 Reviewed-by: David Faure (KDE) Reviewed-by: Lars Knoll --- src/widgets/widgets/qmenu.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/widgets/widgets/qmenu.h') diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 7547c69a10..7fa3336769 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -93,8 +93,13 @@ public: QAction *addSeparator(); + QAction *addSection(const QString &text); + QAction *addSection(const QIcon &icon, const QString &text); + QAction *insertMenu(QAction *before, QMenu *menu); QAction *insertSeparator(QAction *before); + QAction *insertSection(QAction *before, const QString &text); + QAction *insertSection(QAction *before, const QIcon &icon, const QString &text); bool isEmpty() const; void clear(); -- cgit v1.2.3