From af9729ecf4434c5884cb61b990b819aaccd3af9b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 17 Nov 2016 09:27:04 +0100 Subject: 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 --- .../contactlist/ContactDelegate.ui.qml | 23 +++++++++++----------- .../contactlist/ContactDialogForm.ui.qml | 8 ++++---- .../quickcontrols2/contactlist/MainForm.ui.qml | 23 ++++++++-------------- .../contactlist/SectionDelegate.ui.qml | 3 ++- 4 files changed, 25 insertions(+), 32 deletions(-) (limited to 'examples/quickcontrols2') 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 -- cgit v1.2.3