diff options
| author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-02-28 22:08:05 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-01 11:06:55 +0100 |
| commit | a3737d7481aba3b93e23fb0c26e6a4dc13b75658 (patch) | |
| tree | c2616c8b62108c33b3fb1e9591f6fdace1cd7335 /src/controls/qtmenuitem.cpp | |
| parent | edc559b1e0bea1b4eed247e8bf9ada672d7e9dc9 (diff) | |
MenuBar. Menu, MenuItem: Update documentation to new API
Also removed Menu.visibleParent since it had no apparent use. Likewise,
trigger(), and the triggered() signal are now only in MenuItem.
Change-Id: Ide194505664c60906019422a503b189250d6a86e
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/controls/qtmenuitem.cpp')
| -rw-r--r-- | src/controls/qtmenuitem.cpp | 101 |
1 files changed, 67 insertions, 34 deletions
diff --git a/src/controls/qtmenuitem.cpp b/src/controls/qtmenuitem.cpp index 4c43bac09..124ba4c81 100644 --- a/src/controls/qtmenuitem.cpp +++ b/src/controls/qtmenuitem.cpp @@ -108,6 +108,12 @@ void QtMenuBase::setVisualItem(QQuickItem *item) \sa Menu, MenuItem */ +/*! + \qmlproperty bool MenuSeparator::visible + + Whether the menu separator should be visible. +*/ + QtMenuSeparator::QtMenuSeparator(QObject *parent) : QtMenuBase(parent) { @@ -125,12 +131,8 @@ QtMenuText::~QtMenuText() void QtMenuText::setParentMenu(QtMenu *parentMenu) { QtMenuBase::setParentMenu(parentMenu); - connect(this, SIGNAL(triggered()), parentMenu, SLOT(updateSelectedIndex())); -} - -void QtMenuText::trigger() -{ - emit triggered(); + if (qobject_cast<QtMenuItem *>(this)) + connect(this, SIGNAL(triggered()), parentMenu, SLOT(updateSelectedIndex())); } void QtMenuText::setEnabled(bool enabled) @@ -218,53 +220,38 @@ void QtMenuText::setIconName(const QString &iconName) */ /*! - \qmlproperty string MenuItem::text + \qmlproperty bool MenuItem::visible - Text for the menu item. + Whether the menu item should be visible. */ /*! - \qmlproperty string MenuItem::shortcut - - Shorcut bound to the menu item. - - \sa Action::shortcut -*/ - -/*! - \qmlproperty bool MenuItem::checkable - - Whether the menu item can be toggled. + \qmlproperty string MenuItem::text - \sa checked + Text for the menu item. Accelerators are supported with the usual \& convention. */ /*! - \qmlproperty bool MenuItem::checked + \qmlproperty bool MenuItem::enabled - If the menu item is checkable, this property reflects its checked state. - - \sa chekcable, Action::toggled() + Whether the menu item is enabled, and responsive to user interaction. */ /*! \qmlproperty url MenuItem::iconSource + Sets the icon file or resource url for the \l MenuItem icon. + \sa iconName, Action::iconSource */ /*! \qmlproperty string MenuItem::iconName - \sa iconSource, Action::iconName -*/ - -/*! - \qmlproperty Action MenuItem::action - - The action bound to this menu item. + Sets the icon name for the \l MenuItem icon. This will pick the icon + with the given name from the current theme. - \sa Action + \sa iconSource, Action::iconName */ /*! \qmlsignal MenuItem::triggered() @@ -281,13 +268,59 @@ void QtMenuText::setIconName(const QString &iconName) \sa triggered(), Action::trigger() */ +/*! + \qmlproperty string MenuItem::shortcut + + Shorcut bound to the menu item. + + \sa Action::shortcut +*/ + +/*! + \qmlproperty bool MenuItem::checkable + + Whether the menu item can be checked, or toggled. + + \sa checked +*/ + +/*! + \qmlproperty bool MenuItem::checked + + If the menu item is checkable, this property reflects its checked state. + + \sa checkable, Action::toggled() +*/ + /*! \qmlproperty ExclusiveGroup MenuItem::exclusiveGroup - ... + If a menu item is checkable, an \l ExclusiveGroup can be attached to it. + All the menu items sharing the same exclusive group become mutually exclusive + selectable, meaning that only the last checked menu item will actually be checked. \sa checked, checkable */ +/*! \qmlsignal MenuItem::toggled(checked) + + Emitted whenever a menu item's \c checked property changes. + This usually happens at the same time as \l triggered(). + + \sa checked, triggered(), Action::triggered(), Action::toggled() +*/ + +/*! + \qmlproperty Action MenuItem::action + + The action bound to this menu item. Setting this property to an valid + \l Action will override all the menu item's properties except \l text. + + In addition, the menu item \c triggered() and \c toggled() signals will not be emitted. + Instead, the action \c triggered() and \c toggled() signals will be. + + \sa Action +*/ + QtMenuItem::QtMenuItem(QObject *parent) : QtMenuText(parent), m_action(0) { } @@ -509,7 +542,7 @@ void QtMenuItem::trigger() if (m_action) m_action->trigger(); else - QtMenuText::trigger(); + emit triggered(); } QT_END_NAMESPACE |
