aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-12-13 13:35:52 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-12-14 07:16:20 +0000
commit3ec6d04d976249d162f6ec92666d9008f4c21c34 (patch)
tree2faeeae7d2c3fb5e086c91ccd5c1c9bda834005c /src/imports/controls
parent1c265b23ef7494abc6a00094e781a8e48de87121 (diff)
ComboBox: use deferred execution
As a special case, ComboBox defers the execution of the popup until the popup is either accessed or made visible. This gives a nice boost in creation time benchmarks (20->25, ~25%). The old optimization of setting the delegate model only when the popup is visible is no longer needed. Task-number: QTBUG-50992 Change-Id: Ifeaceb759ab676bb54c6bc09dc97810eade72ca1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/ComboBox.qml6
-rw-r--r--src/imports/controls/material/ComboBox.qml6
-rw-r--r--src/imports/controls/universal/ComboBox.qml6
3 files changed, 9 insertions, 9 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 6a885320..8d1a28be 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -80,7 +80,7 @@ T.ComboBox {
enabled: control.editable
autoScroll: control.editable
- readOnly: control.popup.visible
+ readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
@@ -104,7 +104,7 @@ T.ComboBox {
implicitHeight: 40
color: !control.editable && control.visualFocus ? (control.pressed ? Default.focusPressedColor : Default.focusLightColor) :
- (control.down || popup.visible ? Default.buttonPressedColor : Default.buttonColor)
+ (control.down ? Default.buttonPressedColor : Default.buttonColor)
border.color: Default.focusColor
border.width: !control.editable && control.visualFocus ? 2 : 0
visible: !control.flat || control.down
@@ -120,7 +120,7 @@ T.ComboBox {
contentItem: ListView {
clip: true
implicitHeight: contentHeight
- model: control.popup.visible ? control.delegateModel : null
+ model: control.delegateModel
currentIndex: control.highlightedIndex
highlightRangeMode: ListView.ApplyRange
highlightMoveDuration: 0
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index da9fd73c..d2ca7679 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -84,7 +84,7 @@ T.ComboBox {
enabled: control.editable
autoScroll: control.editable
- readOnly: control.popup.visible
+ readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
@@ -161,7 +161,7 @@ T.ComboBox {
contentItem: ListView {
clip: true
implicitHeight: contentHeight
- model: control.popup.visible ? control.delegateModel : null
+ model: control.delegateModel
currentIndex: control.highlightedIndex
highlightRangeMode: ListView.ApplyRange
highlightMoveDuration: 0
@@ -171,7 +171,7 @@ T.ComboBox {
background: Rectangle {
radius: 2
- color: control.popup.Material.dialogColor
+ color: parent.Material.dialogColor
layer.enabled: control.enabled
layer.effect: ElevationEffect {
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index a2ba0236..596dcf5b 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -91,7 +91,7 @@ T.ComboBox {
enabled: control.editable
autoScroll: control.editable
- readOnly: control.popup.visible
+ readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
@@ -111,7 +111,7 @@ T.ComboBox {
border.width: control.flat ? 0 : 2 // ComboBoxBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
control.editable && control.activeFocus ? control.Universal.accent :
- control.down || popup.visible ? control.Universal.baseMediumLowColor :
+ control.down ? control.Universal.baseMediumLowColor :
control.hovered ? control.Universal.baseMediumColor : control.Universal.baseMediumLowColor
color: !control.enabled ? control.Universal.baseLowColor :
control.down ? control.Universal.listMediumColor :
@@ -143,7 +143,7 @@ T.ComboBox {
contentItem: ListView {
clip: true
implicitHeight: contentHeight
- model: control.popup.visible ? control.delegateModel : null
+ model: control.delegateModel
currentIndex: control.highlightedIndex
highlightRangeMode: ListView.ApplyRange
highlightMoveDuration: 0