diff options
author | Kevin Ottens <ervin@kde.org> | 2013-02-27 17:11:41 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-13 15:00:52 +0100 |
commit | 03e2ea2ac057b2b4aa1dc4e5b817ffd552080ce5 (patch) | |
tree | cf306fa7a16caaaff9f0b04234ee6667fe723f11 /src/widgets/widgets/qmenu.h | |
parent | bad1918cb438874e31dee05536e300c3470c7b23 (diff) |
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) <faure@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/widgets/widgets/qmenu.h')
-rw-r--r-- | src/widgets/widgets/qmenu.h | 5 |
1 files changed, 5 insertions, 0 deletions
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(); |