aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/contactlist
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-17 09:27:04 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-17 10:24:30 +0000
commitaf9729ecf4434c5884cb61b990b819aaccd3af9b (patch)
treee718e702ce4c8b135b19f671b2dbe07b5981782b /examples/quickcontrols2/contactlist
parentfe34af03e3e673419513ef139b67321b0ad17e7e (diff)
Contact List example: replace Qt Quick primitives with Controls
This ensures that we get the correct colors when running with different styles. Change-Id: If249f9704fbe157aab1b121cf7d09ee05ab85c14 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quickcontrols2/contactlist')
-rw-r--r--examples/quickcontrols2/contactlist/ContactDelegate.ui.qml23
-rw-r--r--examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml8
-rw-r--r--examples/quickcontrols2/contactlist/MainForm.ui.qml23
-rw-r--r--examples/quickcontrols2/contactlist/SectionDelegate.ui.qml3
4 files changed, 25 insertions, 32 deletions
diff --git a/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
index fb3d88eb..8c8c4722 100644
--- a/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
+++ b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
@@ -73,7 +73,7 @@ AbstractButton {
id: row1
spacing: 10
- Text {
+ Label {
text: fullName
font.pointSize: 16
anchors.verticalCenter: parent.verticalCenter
@@ -88,37 +88,37 @@ AbstractButton {
x: 60
spacing: 10
columns: 2
- Text {
+ Label {
text: qsTr("Address:")
font.bold: true
font.pixelSize: 16
}
- Text {
+ Label {
text: address
font.pixelSize: 16
font.bold: true
}
- Text {
+ Label {
text: qsTr("City:")
font.pixelSize: 16
font.bold: true
}
- Text {
+ Label {
text: city
font.pixelSize: 16
font.bold: true
}
- Text {
+ Label {
text: qsTr("Number:")
font.pixelSize: 16
font.bold: true
}
- Text {
+ Label {
text: number
font.pixelSize: 16
font.bold: true
@@ -145,11 +145,10 @@ AbstractButton {
}
}
- Rectangle {
- id: line
+ MenuSeparator {
+ id: separator
opacity: 0
- height: 1
- color: "#dddddd"
+ padding: 0
anchors.right: parent.right
anchors.rightMargin: 4
anchors.left: parent.left
@@ -172,7 +171,7 @@ AbstractButton {
}
PropertyChanges {
- target: line
+ target: separator
opacity: 1
}
diff --git a/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml b/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml
index 9f07d608..e1f31943 100644
--- a/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml
+++ b/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml
@@ -65,7 +65,7 @@ GridLayout {
rows: 4
columns: 2
- Text {
+ Label {
text: qsTr("Full Name:")
Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
}
@@ -78,7 +78,7 @@ GridLayout {
placeholderText: grid.placeholderText
}
- Text {
+ Label {
text: qsTr("Address")
Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
}
@@ -91,7 +91,7 @@ GridLayout {
placeholderText: grid.placeholderText
}
- Text {
+ Label {
text: qsTr("City")
Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
}
@@ -104,7 +104,7 @@ GridLayout {
placeholderText: grid.placeholderText
}
- Text {
+ Label {
text: qsTr("Number")
Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
}
diff --git a/examples/quickcontrols2/contactlist/MainForm.ui.qml b/examples/quickcontrols2/contactlist/MainForm.ui.qml
index 3779e670..634398bd 100644
--- a/examples/quickcontrols2/contactlist/MainForm.ui.qml
+++ b/examples/quickcontrols2/contactlist/MainForm.ui.qml
@@ -52,7 +52,7 @@ import QtQuick 2.7
import Backend 1.0
import QtQuick.Controls 2.1
-Item {
+Page {
id: form
width: 320
@@ -71,11 +71,7 @@ Item {
boundsBehavior: Flickable.StopAtBounds
clip: true
focus: true
- anchors.bottom: button.top
- anchors.right: parent.right
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.bottomMargin: 4
+ anchors.fill: parent
section.criteria: ViewSection.FirstCharacter
section.property: "fullName"
snapMode: ListView.SnapToItem
@@ -107,14 +103,11 @@ Item {
}
}
- Button {
- id: button
- width: 80
- height: 20
- text: "Add Contact"
- anchors.rightMargin: 4
- anchors.bottomMargin: 4
- anchors.bottom: parent.bottom
- anchors.right: parent.right
+ footer: ToolBar {
+ ToolButton {
+ id: button
+ text: "Add Contact"
+ anchors.right: parent.right
+ }
}
}
diff --git a/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
index 6cc22d61..3b9f7dc5 100644
--- a/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
+++ b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
@@ -49,6 +49,7 @@
****************************************************************************/
import QtQuick 2.7
+import QtQuick.Controls 2.1
Rectangle {
height: 20
@@ -65,7 +66,7 @@ Rectangle {
}
}
- Text {
+ Label {
x: 12
color: "white"
text: section