summaryrefslogtreecommitdiffstats
path: root/src/controls/qtmenuitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/qtmenuitem.cpp')
-rw-r--r--src/controls/qtmenuitem.cpp101
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