diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-07-29 13:32:24 +0200 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-07-29 14:00:43 +0200 |
commit | 49ee45fea42b568fec50c765b04e8b54144c783f (patch) | |
tree | f26c8fb63196a9f33693a46a356556ec9dbff305 /src/controls | |
parent | 20435471f66bbc128436198cb60232f5df353374 (diff) |
MenuStyle: Add pressed property to style data object
[ChangeLog][Styling] Add pressed 'property' for MenuItem styling
in styleData object
Task-number: QTBUG-40178
Change-Id: Id5c2af529ed67981415fb055ce83e2c528da525a
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/ColumnMenuContent.qml | 1 | ||||
-rw-r--r-- | src/controls/Private/MenuContentItem.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/MenuStyle.qml | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/src/controls/Private/ColumnMenuContent.qml b/src/controls/Private/ColumnMenuContent.qml index ff608b473..9c0b2345c 100644 --- a/src/controls/Private/ColumnMenuContent.qml +++ b/src/controls/Private/ColumnMenuContent.qml @@ -50,6 +50,7 @@ Item { property var itemsModel property int minWidth: 100 property real maxHeight: 800 + readonly property bool mousePressed: hoverArea.pressed signal triggered(var item) diff --git a/src/controls/Private/MenuContentItem.qml b/src/controls/Private/MenuContentItem.qml index 669cde2fa..62e5d0333 100644 --- a/src/controls/Private/MenuContentItem.qml +++ b/src/controls/Private/MenuContentItem.qml @@ -178,6 +178,8 @@ Loader { readonly property int index: __menuItemIndex readonly property int type: __menuItem ? __menuItem.type : -1 readonly property bool selected: type !== MenuItemType.Separator && __menu.__currentIndex === index + readonly property bool pressed: type !== MenuItemType.Separator && __menu.__currentIndex === index + && content.mousePressed // TODO Add key pressed condition once we get delayed menu closing readonly property string text: type === MenuItemType.Menu ? __menuItem.title : type !== MenuItemType.Separator ? __menuItem.text : "" readonly property bool underlineMnemonic: __menu.__contentItem.altPressed diff --git a/src/controls/Styles/Base/MenuStyle.qml b/src/controls/Styles/Base/MenuStyle.qml index bfe78f7c2..032cc74e1 100644 --- a/src/controls/Styles/Base/MenuStyle.qml +++ b/src/controls/Styles/Base/MenuStyle.qml @@ -56,6 +56,7 @@ import QtQuick.Controls.Private 1.0 \row \li \b {styleData.index} : int \li The index of the menu item in its menu. \row \li \b {styleData.type} : enumeration \li The type of menu item. See below for possible values. \row \li \b {styleData.selected} : bool \li \c true if the menu item is selected. + \row \li \b {styleData.pressed} : bool \li \c true if the menu item is pressed. Available since 5.4. \row \li \b {styleData.text} : string \li The menu item's text, or title if it's a submenu. \row \li \b {styleData.underlineMnemonic} : bool \li Whether the style should underline the menu item's label mnemonic. \row \li \b {styleData.shortcut} : string \li The text for the menu item's shortcut. |