aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2016-03-18 16:29:33 +0100
committerMitch Curtis <mitch.curtis@theqtcompany.com>2016-04-19 14:54:18 +0000
commit29f99bd56f5384c390c7a7cc7ebf5a0fe50c1edc (patch)
treed013153bbfae18fe5eed46cf3efe0b15eacea48d
parente253427f93248983d18055c5020094799a2c6b3b (diff)
Update Default style ComboBox to match new design specs
Change-Id: Iac0038c6854685b031d5343b651836d9b605a6d0 Task-number: QTBUG-50993 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/imports/controls/ComboBox.qml40
-rw-r--r--src/imports/controls/images/double-arrow-focus.pngbin0 -> 1282 bytes
-rw-r--r--src/imports/controls/images/double-arrow-focus@2x.pngbin0 -> 1697 bytes
-rw-r--r--src/imports/controls/images/double-arrow-focus@3x.pngbin0 -> 2067 bytes
-rw-r--r--src/imports/controls/images/double-arrow-focus@4x.pngbin0 -> 2551 bytes
-rw-r--r--src/imports/controls/images/double-arrow.pngbin0 -> 1275 bytes
-rw-r--r--src/imports/controls/images/double-arrow@2x.pngbin0 -> 1690 bytes
-rw-r--r--src/imports/controls/images/double-arrow@3x.pngbin0 -> 2059 bytes
-rw-r--r--src/imports/controls/images/double-arrow@4x.pngbin0 -> 2523 bytes
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.qrc8
10 files changed, 27 insertions, 21 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index cb9735a2..c04ca842 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -42,24 +42,23 @@ import Qt.labs.templates 1.0 as T
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: (background ? background.implicitWidth : contentItem.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 8
padding: 6
- leftPadding: 8
- rightPadding: 8
+ leftPadding: 12
+ rightPadding: 12
+
+ opacity: enabled ? 1 : 0.3
//! [delegate]
delegate: ItemDelegate {
width: control.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
- autoExclusive: true
- checked: control.currentIndex === index
- highlighted: control.highlightedIndex === index
+ font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
+ highlighted: control.highlightedIndex == index
}
//! [delegate]
@@ -67,7 +66,7 @@ T.ComboBox {
contentItem: Text {
text: control.displayText
font: control.font
- color: "#ffffff"
+ color: control.activeKeyFocus ? "#0066ff" : "#353637"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -76,28 +75,27 @@ T.ComboBox {
//! [contentItem]
//! [background]
- background: Item {
+ background: Rectangle {
implicitWidth: 120
implicitHeight: 40
- Rectangle {
- width: parent.width
- height: parent.height
- opacity: control.enabled ? 1.0 : 0.2
- color: control.pressed || popup.visible ? "#585A5C" : "#353637"
- }
+ color: control.activeKeyFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") :
+ (control.pressed || popup.visible ? "#d6d6d6" : "#f6f6f6")
+ border.color: control.activeKeyFocus ? "#0066ff" : "#353637"
+ border.width: control.activeKeyFocus ? 2 : 1
Image {
- x: parent.width - width - control.rightPadding
+ x: parent.width - width - 4
y: (parent.height - height) / 2
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/drop-indicator.png"
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/double-arrow"
+ + (control.activeKeyFocus ? "-focus" : "") + ".png"
}
}
//! [background]
//! [popup]
popup: T.Popup {
- y: control.height - 1
+ y: control.height - (control.activeKeyFocus ? 0 : 1)
implicitWidth: control.width
implicitHeight: listview.contentHeight
topMargin: 6
@@ -114,8 +112,8 @@ T.ComboBox {
parent: listview
width: listview.width
height: listview.height
- border.color: "#353637"
color: "transparent"
+ border.color: "#353637"
}
T.ScrollIndicator.vertical: ScrollIndicator { }
diff --git a/src/imports/controls/images/double-arrow-focus.png b/src/imports/controls/images/double-arrow-focus.png
new file mode 100644
index 00000000..d68de2c2
--- /dev/null
+++ b/src/imports/controls/images/double-arrow-focus.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow-focus@2x.png b/src/imports/controls/images/double-arrow-focus@2x.png
new file mode 100644
index 00000000..d0686fc8
--- /dev/null
+++ b/src/imports/controls/images/double-arrow-focus@2x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow-focus@3x.png b/src/imports/controls/images/double-arrow-focus@3x.png
new file mode 100644
index 00000000..2cf08077
--- /dev/null
+++ b/src/imports/controls/images/double-arrow-focus@3x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow-focus@4x.png b/src/imports/controls/images/double-arrow-focus@4x.png
new file mode 100644
index 00000000..e0b6eeb3
--- /dev/null
+++ b/src/imports/controls/images/double-arrow-focus@4x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow.png b/src/imports/controls/images/double-arrow.png
new file mode 100644
index 00000000..a6d84dbc
--- /dev/null
+++ b/src/imports/controls/images/double-arrow.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@2x.png b/src/imports/controls/images/double-arrow@2x.png
new file mode 100644
index 00000000..36ffd5fe
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@2x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@3x.png b/src/imports/controls/images/double-arrow@3x.png
new file mode 100644
index 00000000..5a2a59fe
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@3x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@4x.png b/src/imports/controls/images/double-arrow@4x.png
new file mode 100644
index 00000000..22977545
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@4x.png
Binary files differ
diff --git a/src/imports/controls/qtquickcontrols2plugin.qrc b/src/imports/controls/qtquickcontrols2plugin.qrc
index 227bd435..75fe80c2 100644
--- a/src/imports/controls/qtquickcontrols2plugin.qrc
+++ b/src/imports/controls/qtquickcontrols2plugin.qrc
@@ -16,5 +16,13 @@
<file>images/check-focus@2x.png</file>
<file>images/check-focus@3x.png</file>
<file>images/check-focus@4x.png</file>
+ <file>images/double-arrow.png</file>
+ <file>images/double-arrow@2x.png</file>
+ <file>images/double-arrow@3x.png</file>
+ <file>images/double-arrow@4x.png</file>
+ <file>images/double-arrow-focus.png</file>
+ <file>images/double-arrow-focus@2x.png</file>
+ <file>images/double-arrow-focus@3x.png</file>
+ <file>images/double-arrow-focus@4x.png</file>
</qresource>
</RCC>