aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-17 22:23:30 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-18 10:40:46 +0000
commit0cfadeb6de542548c45ef485a4452e820cefb401 (patch)
tree51c524129d26c7c7f9c929fe1b548e5e7575e3e6
parent82a7941020b04ffb9b78a9c94ac8d75bbdb099e9 (diff)
Contact List: tweak the section header
Replace the old-fashioned gradient with a ToolBar. It stands out more than well enough, and is fully style-agnostic. Also, give descriptive IDs for better designer integration/preview. Change-Id: Ib2d4404e3c0fa769ac661645046a25e578f62d37 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--examples/quickcontrols2/contactlist/MainForm.ui.qml4
-rw-r--r--examples/quickcontrols2/contactlist/SectionDelegate.ui.qml25
2 files changed, 8 insertions, 21 deletions
diff --git a/examples/quickcontrols2/contactlist/MainForm.ui.qml b/examples/quickcontrols2/contactlist/MainForm.ui.qml
index fdc6dd91..1639ecc8 100644
--- a/examples/quickcontrols2/contactlist/MainForm.ui.qml
+++ b/examples/quickcontrols2/contactlist/MainForm.ui.qml
@@ -69,11 +69,11 @@ Page {
focus: true
anchors.fill: parent
- section.criteria: ViewSection.FirstCharacter
- section.property: "fullName"
snapMode: ListView.SnapToItem
boundsBehavior: Flickable.StopAtBounds
+ section.property: "fullName"
+ section.criteria: ViewSection.FirstCharacter
section.delegate: SectionDelegate {
width: listView.width
}
diff --git a/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
index 3b9f7dc5..fa64ffbf 100644
--- a/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
+++ b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
@@ -51,27 +51,14 @@
import QtQuick 2.7
import QtQuick.Controls 2.1
-Rectangle {
- height: 20
- width: 120
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#dddddd"
- }
-
- GradientStop {
- position: 1
- color: "blue"
- }
- }
+ToolBar {
+ id: background
Label {
- x: 12
- color: "white"
+ id: label
text: section
- style: Text.Raised
- font.pixelSize: 18
- font.bold: true
+ anchors.fill: parent
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
}
}