summaryrefslogtreecommitdiff
path: root/src/controls/ComboBox.qml
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-02-26 20:04:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-27 07:41:23 +0100
commit44fae3e87c7534fa7bb8f6b26c697e84623f2437 (patch)
tree3599c7778e54a362eb994739ff816c9b5cb5a5a7 /src/controls/ComboBox.qml
parent95f2968d9126ca1a9af3b6729e319d3fa2994f23 (diff)
downloadqtquickcontrols-44fae3e87c7534fa7bb8f6b26c697e84623f2437.tar.gz
ComboBox: Fixed appearance after popup closed
Also removed popupOpen property since it was not doing what the documentation said anyway. Change-Id: I0bb50890000d8305ebc2d668a8ba3fd628bd5e78 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/controls/ComboBox.qml')
-rw-r--r--src/controls/ComboBox.qml12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 9ebcadf5..e1b019e1 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -57,7 +57,6 @@ import "Styles/Settings.js" as Settings
ListModel model - this model will be used, in addition to MenuItem children, to
create items inside the popup menu
- bool popupOpen - setting this property to 'true' will open the popup.
int selectedIndex - the index of the selected item in the popup menu.
string selectedText - the text of the selected menu item.
@@ -100,12 +99,11 @@ Control {
default property alias menuItems: popup.menuItems
property alias model: popup.model
property alias textRole: popup.textRole
- property bool popupOpen: false
property alias selectedIndex: popup.selectedIndex
readonly property alias selectedText: popup.selectedText
- readonly property bool pressed: mouseArea.pressed || popup.popupVisible
+ readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.popupVisible
/* \internal */
property alias __containsMouse: mouseArea.containsMouse
@@ -117,6 +115,7 @@ Control {
MouseArea {
id: mouseArea
anchors.fill: parent
+ hoverEnabled: true
onPressedChanged: if (pressed) popup.show()
}
@@ -152,22 +151,17 @@ Control {
}
function show() {
- comboBox.popupOpen = true
menuItems[comboBox.selectedIndex].checked = true
currentIndex = comboBox.selectedIndex
showPopup(x, y, centerSelectedText ? comboBox.selectedIndex : 0, comboBox)
}
-
- onMenuClosed: popupOpen = false
}
// The key bindings below will only be in use when popup is
// not visible. Otherwise, native popup key handling will take place:
Keys.onSpacePressed: {
- if (!popupOpen)
+ if (!popup.popupVisible)
popup.show()
- else
- popupOpen = false
}
Keys.onUpPressed: { if (selectedIndex > 0) selectedIndex-- }
Keys.onDownPressed: { if (selectedIndex < model.count - 1) selectedIndex++ }