aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/chattutorial/chapter5-styling
diff options
context:
space:
mode:
authorMitch Curtis <[email protected]>2021-08-12 14:39:51 +0200
committerMitch Curtis <[email protected]>2021-08-16 12:52:59 +0200
commit809339d1484cf556512534367b8170bc26baf072 (patch)
tree12871313b658f36d058b5ef25af1e247e9c46ce9 /examples/quickcontrols2/chattutorial/chapter5-styling
parentb01b4f00eae8022c6a97d90f54dac395144ae095 (diff)
Remove qtquickcontrols2 sources and explain where they wentHEADdev
Now that qtquickcontrols2 has been merged into qtdeclarative, we should make it obvious that this repo should no longer be used, by preventing it from being built. Task-number: QTBUG-95173 Pick-to: 6.2 Change-Id: I95bd6a214f3d75a865ab163ee0a1f9ffbeb7a051 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'examples/quickcontrols2/chattutorial/chapter5-styling')
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml56
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt86
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml54
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml90
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml164
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro18
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp99
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/main.qml66
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc10
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf7
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp90
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h62
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp154
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h79
14 files changed, 0 insertions, 1035 deletions
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml
deleted file mode 100644
index d4a66764..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** 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.Controls
-import QtQuick.Controls.Material
-
-ToolBar {
- Material.theme: Material.Dark
-}
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt
deleted file mode 100644
index c48daafc..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-# Generated from chapter5-styling.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(chapter5-styling LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter5-styling")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Sql)
-
-qt_add_executable(chapter5-styling
- main.cpp
- sqlcontactmodel.cpp sqlcontactmodel.h
- sqlconversationmodel.cpp sqlconversationmodel.h
-)
-set_target_properties(chapter5-styling PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter5-styling PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- Qt::Sql
-)
-
-
-# Resources:
-set(qml_resource_files
- "+Material/ChatToolBar.qml"
- "ChatToolBar.qml"
- "ContactPage.qml"
- "ConversationPage.qml"
- "main.qml"
- "qtquickcontrols2.conf"
-)
-
-qt6_add_resources(chapter5-styling "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-set(shared_resource_files
- "../shared/Albert_Einstein.png"
- "../shared/[email protected]"
- "../shared/[email protected]"
- "../shared/[email protected]"
- "../shared/Ernest_Hemingway.png"
- "../shared/[email protected]"
- "../shared/[email protected]"
- "../shared/[email protected]"
- "../shared/Hans_Gude.png"
- "../shared/[email protected]"
- "../shared/[email protected]"
- "../shared/[email protected]"
-)
-
-qt6_add_resources(chapter5-styling "shared"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS chapter5-styling
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml
deleted file mode 100644
index c192aeb5..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** 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.Controls
-
-ToolBar {
-}
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml
deleted file mode 100644
index 65460bf1..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** 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("qrc:/ConversationPage.qml", { inConversationWith: model.display })
-
- Image {
- id: avatar
- source: "qrc:/" + model.display.replace(" ", "_") + ".png"
- }
- }
- }
-}
-
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml
deleted file mode 100644
index c668072e..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** 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.Layouts
-import QtQuick.Controls
-
-import io.qt.examples.chattutorial
-
-Page {
- id: root
-
- property string inConversationWith
-
- header: ChatToolBar {
- ToolButton {
- text: qsTr("Back")
- anchors.left: parent.left
- anchors.leftMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- onClicked: root.StackView.view.pop()
- }
-
- Label {
- id: pageTitle
- text: inConversationWith
- font.pixelSize: 20
- anchors.centerIn: parent
- }
- }
-
- ColumnLayout {
- anchors.fill: parent
-
- ListView {
- id: listView
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.margins: pane.leftPadding + messageField.leftPadding
- displayMarginBeginning: 40
- displayMarginEnd: 40
- verticalLayoutDirection: ListView.BottomToTop
- spacing: 12
- model: SqlConversationModel {
- recipient: inConversationWith
- }
- delegate: Column {
- anchors.right: sentByMe ? listView.contentItem.right : undefined
- spacing: 6
-
- readonly property bool sentByMe: model.recipient !== "Me"
-
- Row {
- id: messageRow
- spacing: 6
- anchors.right: sentByMe ? parent.right : undefined
-
- Image {
- id: avatar
- source: !sentByMe ? "qrc:/" + model.author.replace(" ", "_") + ".png" : ""
- }
-
- Rectangle {
- width: Math.min(messageText.implicitWidth + 24, listView.width - avatar.width - messageRow.spacing)
- height: messageText.implicitHeight + 24
- color: sentByMe ? "lightgrey" : "steelblue"
-
- Label {
- id: messageText
- text: model.message
- color: sentByMe ? "black" : "white"
- anchors.fill: parent
- anchors.margins: 12
- wrapMode: Label.Wrap
- }
- }
- }
-
- Label {
- id: timestampText
- text: Qt.formatDateTime(model.timestamp, "d MMM hh:mm")
- color: "lightgrey"
- anchors.right: sentByMe ? parent.right : undefined
- }
- }
-
- ScrollBar.vertical: ScrollBar {}
- }
-
- Pane {
- id: pane
- Layout.fillWidth: true
-
- RowLayout {
- width: parent.width
-
- TextArea {
- id: messageField
- Layout.fillWidth: true
- placeholderText: qsTr("Compose message")
- wrapMode: TextArea.Wrap
- }
-
- Button {
- id: sendButton
- text: qsTr("Send")
- enabled: messageField.length > 0
- onClicked: {
- listView.model.sendMessage(inConversationWith, messageField.text);
- messageField.text = "";
- }
- }
- }
- }
- }
-}
-
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro b/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro
deleted file mode 100644
index e798fe3c..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick sql
-CONFIG += c++11
-
-HEADERS += sqlcontactmodel.h \
- sqlconversationmodel.h
-
-SOURCES += main.cpp \
- sqlcontactmodel.cpp \
- sqlconversationmodel.cpp
-
-RESOURCES += \
- qml.qrc \
- ../shared/shared.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5-styling
-INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp b/examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp
deleted file mode 100644
index bbe7b3ad..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <QGuiApplication>
-#include <QSqlDatabase>
-#include <QSqlError>
-#include <QtQml>
-
-#include "sqlcontactmodel.h"
-#include "sqlconversationmodel.h"
-
-static void connectToDatabase()
-{
- QSqlDatabase database = QSqlDatabase::database();
- if (!database.isValid()) {
- database = QSqlDatabase::addDatabase("QSQLITE");
- if (!database.isValid())
- qFatal("Cannot add database: %s", qPrintable(database.lastError().text()));
- }
-
- const QDir writeDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
- if (!writeDir.mkpath("."))
- qFatal("Failed to create writable directory at %s", qPrintable(writeDir.absolutePath()));
-
- // Ensure that we have a writable location on all devices.
- const QString fileName = writeDir.absolutePath() + "/chat-database.sqlite3";
- // When using the SQLite driver, open() will create the SQLite database if it doesn't exist.
- database.setDatabaseName(fileName);
- if (!database.open()) {
- qFatal("Cannot open database: %s", qPrintable(database.lastError().text()));
- QFile::remove(fileName);
- }
-}
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- qmlRegisterType<SqlContactModel>("io.qt.examples.chattutorial", 1, 0, "SqlContactModel");
- qmlRegisterType<SqlConversationModel>("io.qt.examples.chattutorial", 1, 0, "SqlConversationModel");
-
- connectToDatabase();
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- if (engine.rootObjects().isEmpty())
- return -1;
-
- return app.exec();
-}
-
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/main.qml b/examples/quickcontrols2/chattutorial/chapter5-styling/main.qml
deleted file mode 100644
index 029f45e3..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/main.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-ApplicationWindow {
- id: window
- width: 540
- height: 960
- visible: true
-
- StackView {
- id: stackView
- anchors.fill: parent
- initialItem: ContactPage {}
- }
-}
-
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc b/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc
deleted file mode 100644
index 54cf6d5a..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>ContactPage.qml</file>
- <file>ConversationPage.qml</file>
- <file>qtquickcontrols2.conf</file>
- <file>ChatToolBar.qml</file>
- <file>+Material/ChatToolBar.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf
deleted file mode 100644
index e338c804..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[material]
-Primary=Indigo
-Accent=Indigo
-Theme=Dark
-
-[Universal]
-Theme=Dark
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp b/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp
deleted file mode 100644
index 6203ebec..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "sqlcontactmodel.h"
-
-#include <QDebug>
-#include <QSqlError>
-#include <QSqlQuery>
-
-static void createTable()
-{
- if (QSqlDatabase::database().tables().contains(QStringLiteral("Contacts"))) {
- // The table already exists; we don't need to do anything.
- return;
- }
-
- QSqlQuery query;
- if (!query.exec(
- "CREATE TABLE IF NOT EXISTS 'Contacts' ("
- " 'name' TEXT NOT NULL,"
- " PRIMARY KEY(name)"
- ")")) {
- qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
- }
-
- query.exec("INSERT INTO Contacts VALUES('Albert Einstein')");
- query.exec("INSERT INTO Contacts VALUES('Ernest Hemingway')");
- query.exec("INSERT INTO Contacts VALUES('Hans Gude')");
-}
-
-SqlContactModel::SqlContactModel(QObject *parent) :
- QSqlQueryModel(parent)
-{
- createTable();
-
- QSqlQuery query;
- if (!query.exec("SELECT * FROM Contacts"))
- qFatal("Contacts SELECT query failed: %s", qPrintable(query.lastError().text()));
-
- setQuery(query);
- if (lastError().isValid())
- qFatal("Cannot set query on SqlContactModel: %s", qPrintable(lastError().text()));
-}
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h b/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h
deleted file mode 100644
index fdbe5f1e..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef SQLCONTACTMODEL_H
-#define SQLCONTACTMODEL_H
-
-#include <QSqlQueryModel>
-
-class SqlContactModel : public QSqlQueryModel
-{
-public:
- SqlContactModel(QObject *parent = 0);
-};
-
-#endif // SQLCONTACTMODEL_H
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp b/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp
deleted file mode 100644
index 99526e81..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "sqlconversationmodel.h"
-
-#include <QDateTime>
-#include <QDebug>
-#include <QSqlError>
-#include <QSqlRecord>
-#include <QSqlQuery>
-
-static const char *conversationsTableName = "Conversations";
-
-static void createTable()
-{
- if (QSqlDatabase::database().tables().contains(conversationsTableName)) {
- // The table already exists; we don't need to do anything.
- return;
- }
-
- QSqlQuery query;
- if (!query.exec(
- "CREATE TABLE IF NOT EXISTS 'Conversations' ("
- "'author' TEXT NOT NULL,"
- "'recipient' TEXT NOT NULL,"
- "'timestamp' TEXT NOT NULL,"
- "'message' TEXT NOT NULL,"
- "FOREIGN KEY('author') REFERENCES Contacts ( name ),"
- "FOREIGN KEY('recipient') REFERENCES Contacts ( name )"
- ")")) {
- qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
- }
-
- query.exec("INSERT INTO Conversations VALUES('Me', 'Ernest Hemingway', '2016-01-07T14:36:06', 'Hello!')");
- query.exec("INSERT INTO Conversations VALUES('Ernest Hemingway', 'Me', '2016-01-07T14:36:16', 'Good afternoon.')");
- query.exec("INSERT INTO Conversations VALUES('Me', 'Albert Einstein', '2016-01-01T11:24:53', 'Hi!')");
- query.exec("INSERT INTO Conversations VALUES('Albert Einstein', 'Me', '2016-01-07T14:36:16', 'Good morning.')");
- query.exec("INSERT INTO Conversations VALUES('Hans Gude', 'Me', '2015-11-20T06:30:02', 'God morgen. Har du fått mitt maleri?')");
- query.exec("INSERT INTO Conversations VALUES('Me', 'Hans Gude', '2015-11-20T08:21:03', 'God morgen, Hans. Ja, det er veldig fint. Tusen takk! "
- "Hvor mange timer har du brukt på den?')");
-}
-
-SqlConversationModel::SqlConversationModel(QObject *parent) :
- QSqlTableModel(parent)
-{
- createTable();
- setTable(conversationsTableName);
- setSort(2, Qt::DescendingOrder);
- // Ensures that the model is sorted correctly after submitting a new row.
- setEditStrategy(QSqlTableModel::OnManualSubmit);
-}
-
-QString SqlConversationModel::recipient() const
-{
- return m_recipient;
-}
-
-void SqlConversationModel::setRecipient(const QString &recipient)
-{
- if (recipient == m_recipient)
- return;
-
- m_recipient = recipient;
-
- const QString filterString = QString::fromLatin1(
- "(recipient = '%1' AND author = 'Me') OR (recipient = 'Me' AND author='%1')").arg(m_recipient);
- setFilter(filterString);
- select();
-
- emit recipientChanged();
-}
-
-QVariant SqlConversationModel::data(const QModelIndex &index, int role) const
-{
- if (role < Qt::UserRole)
- return QSqlTableModel::data(index, role);
-
- const QSqlRecord sqlRecord = record(index.row());
- return sqlRecord.value(role - Qt::UserRole);
-}
-
-QHash<int, QByteArray> SqlConversationModel::roleNames() const
-{
- QHash<int, QByteArray> names;
- names[Qt::UserRole] = "author";
- names[Qt::UserRole + 1] = "recipient";
- names[Qt::UserRole + 2] = "timestamp";
- names[Qt::UserRole + 3] = "message";
- return names;
-}
-
-void SqlConversationModel::sendMessage(const QString &recipient, const QString &message)
-{
- const QString timestamp = QDateTime::currentDateTime().toString(Qt::ISODate);
-
- QSqlRecord newRecord = record();
- newRecord.setValue("author", "Me");
- newRecord.setValue("recipient", recipient);
- newRecord.setValue("timestamp", timestamp);
- newRecord.setValue("message", message);
- if (!insertRecord(rowCount(), newRecord)) {
- qWarning() << "Failed to send message:" << lastError().text();
- return;
- }
-
- submitAll();
-}
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h b/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h
deleted file mode 100644
index 14ab12e2..00000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef SQLCONVERSATIONMODEL_H
-#define SQLCONVERSATIONMODEL_H
-
-#include <QSqlTableModel>
-
-class SqlConversationModel : public QSqlTableModel
-{
- Q_OBJECT
- Q_PROPERTY(QString recipient READ recipient WRITE setRecipient NOTIFY recipientChanged)
-
-public:
- SqlConversationModel(QObject *parent = 0);
-
- QString recipient() const;
- void setRecipient(const QString &recipient);
-
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
-
- Q_INVOKABLE void sendMessage(const QString &recipient, const QString &message);
-
-signals:
- void recipientChanged();
-
-private:
- QString m_recipient;
-};
-
-#endif // SQLCONVERSATIONMODEL_H