diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-11-08 12:02:30 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-11-09 18:55:15 +0100 |
commit | 5e8e12b342657b9dabffd86e7f2b0d1ae194bd54 (patch) | |
tree | 114749d8464a72acbbda15fd37a1f9a1a7d8aff8 /examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml | |
parent | de6c7aa7340b96e8d1d480011dc11a1a094074e2 (diff) |
Fix CMakeLists.txts of chattutorial
- Run pro2cmake.py on each .pro and did some manual adjustments.
- Rename directories to simplify resource paths, URIs, etc.
- Rename executables to ensure they're distinguishable from other
targets in Creator's locator.
- Duplicate images into each example due to issues with resources.
- Now that we use qt_add_qml_module, the qtquickcontrols2.conf
file will no longer be at the resource root, so specify it
separately with qt6_add_resources.
- Update qmake files.
- Fix documentation.
Task-number: QTBUG-98130
Pick-to: 6.2
Change-Id: I210ef2cbcd45dd7f4df881332174bff1b18c5be7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml')
-rw-r--r-- | examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml b/examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml new file mode 100644 index 0000000000..34a138edca --- /dev/null +++ b/examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls + +import io.qt.examples.chattutorial + +Page { + id: root + + header: ChatToolBar { + Label { + text: qsTr("Contacts") + font.pixelSize: 20 + anchors.centerIn: parent + } + } + + ListView { + id: listView + anchors.fill: parent + topMargin: 48 + leftMargin: 48 + bottomMargin: 48 + rightMargin: 48 + spacing: 20 + model: SqlContactModel {} + delegate: ItemDelegate { + text: model.display + width: listView.width - listView.leftMargin - listView.rightMargin + height: avatar.implicitHeight + leftPadding: avatar.implicitWidth + 32 + onClicked: root.StackView.view.push("ConversationPage.qml", { inConversationWith: model.display }) + + Image { + id: avatar + source: "images/" + model.display.replace(" ", "_") + ".png" + } + } + } +} + |