aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/quick/calendar/calendar.pro12
-rw-r--r--examples/quick/calendar/calendar.qrc5
-rw-r--r--examples/quick/calendar/main.cpp149
-rw-r--r--examples/quick/calendar/main.qml237
-rw-r--r--examples/quick/controls/controls.pro6
-rw-r--r--examples/quick/controls/drawer/drawer.pro12
-rw-r--r--examples/quick/controls/drawer/drawer.qrc7
-rw-r--r--examples/quick/controls/drawer/images/arrow.pngbin0 -> 2446 bytes
-rw-r--r--examples/quick/controls/drawer/images/qt-logo.pngbin0 -> 21710 bytes
-rw-r--r--examples/quick/controls/drawer/main.cpp46
-rw-r--r--examples/quick/controls/drawer/main.qml154
-rw-r--r--examples/quick/controls/mirroring/main.cpp46
-rw-r--r--examples/quick/controls/mirroring/main.qml233
-rw-r--r--examples/quick/controls/mirroring/mirroring.pro12
-rw-r--r--examples/quick/controls/mirroring/mirroring.qrc5
-rw-r--r--examples/quick/controls/styles/main.cpp46
-rw-r--r--examples/quick/controls/styles/main.qml191
-rw-r--r--examples/quick/controls/styles/styles.pro12
-rw-r--r--examples/quick/controls/styles/styles.qrc5
-rw-r--r--examples/quick/controls/tabs/images/qt-logo.pngbin0 -> 21710 bytes
-rw-r--r--examples/quick/controls/tabs/main.cpp46
-rw-r--r--examples/quick/controls/tabs/main.qml272
-rw-r--r--examples/quick/controls/tabs/tabs.pro12
-rw-r--r--examples/quick/controls/tabs/tabs.qrc6
-rw-r--r--examples/quick/quick.pro4
26 files changed, 1521 insertions, 0 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 00000000..9d95812f
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ quick
diff --git a/examples/quick/calendar/calendar.pro b/examples/quick/calendar/calendar.pro
new file mode 100644
index 00000000..d08794e6
--- /dev/null
+++ b/examples/quick/calendar/calendar.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = calendar
+QT += quick sql
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ calendar.qrc
diff --git a/examples/quick/calendar/calendar.qrc b/examples/quick/calendar/calendar.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/calendar/calendar.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/calendar/main.cpp b/examples/quick/calendar/main.cpp
new file mode 100644
index 00000000..d8fe5921
--- /dev/null
+++ b/examples/quick/calendar/main.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtQml>
+#include <QtSql>
+
+class Event : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name MEMBER name NOTIFY nameChanged)
+ Q_PROPERTY(QDateTime start MEMBER start NOTIFY startChanged)
+ Q_PROPERTY(QDateTime end MEMBER end NOTIFY endChanged)
+
+public:
+ explicit Event(const QString &name, QObject *parent = 0) : QObject(parent), name(name) { }
+
+ QString name;
+ QDateTime start;
+ QDateTime end;
+
+signals:
+ void nameChanged();
+ void startChanged();
+ void endChanged();
+};
+
+class SqlEventModel : public QSqlQueryModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QDate min READ min CONSTANT)
+ Q_PROPERTY(QDate max READ max CONSTANT)
+
+public:
+ SqlEventModel(QObject *parent = 0) : QSqlQueryModel(parent) { }
+
+ QDate min() const
+ {
+ QSqlQuery query(QStringLiteral("SELECT MIN(start) FROM Event"));
+ if (query.next())
+ return QDateTime::fromMSecsSinceEpoch(query.value(0).toLongLong()).date();
+ return QDate();
+ }
+
+ QDate max() const
+ {
+ QSqlQuery query(QStringLiteral("SELECT MAX(end) FROM Event"));
+ if (query.next())
+ return QDateTime::fromMSecsSinceEpoch(query.value(0).toLongLong()).date();
+ return QDate();
+ }
+
+ Q_INVOKABLE QList<QObject*> eventsForDate(const QDate &date)
+ {
+ qint64 from = QDateTime(date, QTime(0, 0)).toMSecsSinceEpoch();
+ qint64 to = QDateTime(date, QTime(23, 59)).toMSecsSinceEpoch();
+
+ QSqlQuery query;
+ if (!query.exec(QStringLiteral("SELECT * FROM Event WHERE start <= %1 AND end >= %2").arg(to).arg(from)))
+ qFatal("Query failed");
+
+ QList<QObject*> events;
+ while (query.next()) {
+ Event *event = new Event(query.value("name").toString(), this);
+ event->start = QDateTime::fromMSecsSinceEpoch(query.value("start").toLongLong());
+ event->end = QDateTime::fromMSecsSinceEpoch(query.value("end").toLongLong());
+ events.append(event);
+ }
+ return events;
+ }
+};
+
+// create an in-memory SQLITE database
+static bool addEvent(QSqlQuery* query, const QString &name, const QDateTime &start, qint64 duration = 0)
+{
+ QDateTime end = start.addSecs(duration);
+ return query->exec(QStringLiteral("insert into Event values('%1', %2, %3)").arg(name)
+ .arg(start.toMSecsSinceEpoch())
+ .arg(end.toMSecsSinceEpoch()));
+}
+
+static void createDatabase()
+{
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
+ db.setDatabaseName(":memory:");
+ if (!db.open()) {
+ qFatal("Cannot open database");
+ return;
+ }
+
+ QSqlQuery query;
+ query.exec("create table if not exists Event (name TEXT, start BIGINT, end BIGINT)");
+
+ const QDate current = QDate::currentDate();
+ addEvent(&query, "Job interview", QDateTime(current.addDays(-19), QTime(12, 0)));
+ addEvent(&query, "Grocery shopping", QDateTime(current.addDays(-14), QTime(18, 0)));
+ addEvent(&query, "Ice skating", QDateTime(current.addDays(-14), QTime(20, 0)), 5400);
+ addEvent(&query, "Dentist's appointment", QDateTime(current.addDays(-8), QTime(14, 0)), 1800);
+ addEvent(&query, "Cross-country skiing", QDateTime(current.addDays(1), QTime(19, 30)), 3600);
+ addEvent(&query, "Conference", QDateTime(current.addDays(10), QTime(9, 0)), 432000);
+ addEvent(&query, "Hairdresser", QDateTime(current.addDays(19), QTime(13, 0)));
+ addEvent(&query, "Doctor's appointment", QDateTime(current.addDays(21), QTime(16, 0)));
+ addEvent(&query, "Vacation", QDateTime(current.addDays(35), QTime(0, 0)), 604800);
+}
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ createDatabase();
+ qmlRegisterType<SqlEventModel>("io.qt.examples.calendar", 1, 0, "SqlEventModel");
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/quick/calendar/main.qml b/examples/quick/calendar/main.qml
new file mode 100644
index 00000000..7fabf979
--- /dev/null
+++ b/examples/quick/calendar/main.qml
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+import io.qt.examples.calendar 1.0
+
+ApplicationWindow {
+ id: window
+ width: 640
+ height: 400
+ minimumWidth: 400
+ minimumHeight: 300
+ color: "#f4f4f4"
+ visible: true
+ title: "Qt Quick Controls - Calendar Example"
+
+ SqlEventModel {
+ id: eventModel
+ }
+
+ Flow {
+ id: row
+ anchors.fill: parent
+ anchors.margins: 20
+ spacing: 10
+ layoutDirection: Qt.RightToLeft
+
+ ListView {
+ id: calendar
+ property date selectedDate: new Date()
+
+ clip: true
+ width: (parent.width > parent.height ? (parent.width - parent.spacing) * 0.6 : parent.width)
+ height: (parent.height > parent.width ? (parent.height - parent.spacing) * 0.6 : parent.height)
+
+ model: CalendarModel {
+ id: model
+ from: eventModel.min
+ to: eventModel.max
+ }
+
+ focus: true
+ currentIndex: -1
+ snapMode: ListView.SnapOneItem
+ highlightMoveDuration: 250
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ orientation: parent.width > parent.height ? ListView.Vertical : ListView.Horizontal
+
+ delegate: CalendarView {
+ id: delegate
+
+ width: calendar.width
+ height: calendar.height
+
+ month: model.month
+ year: model.year
+
+ padding.top: title.height
+ Column {
+ id: title
+ x: delegate.contentItem.x
+ width: delegate.contentItem.width
+ spacing: window.style.spacing
+ Text {
+ width: parent.width
+ height: implicitHeight * 2
+ text: delegate.title
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pointSize: 18
+ }
+ DayOfWeekRow {
+ width: parent.width
+ }
+ }
+
+ padding.left: weekNumbers.width
+ WeekNumberColumn {
+ id: weekNumbers
+ month: model.month
+ year: model.year
+ y: delegate.contentItem.y
+ height: delegate.contentItem.height
+ }
+
+ onClicked: calendar.selectedDate = date
+
+ delegate: CalendarDelegate {
+ text: model.day
+ width: delegate.contentItem.width / 7
+ height: delegate.contentItem.height / 6
+ opacity: model.month === delegate.month ? 1 : 0
+ color: model.today ? window.style.accentColor : window.style.textColor
+ Rectangle {
+ z: -1
+ anchors.centerIn: parent
+ width: Math.min(parent.width * 0.6, parent.width * 0.6)
+ height: width
+ radius: width / 2
+ opacity: 0.5
+ color: pressed ? window.style.pressColor : "transparent"
+ border.color: eventModel.eventsForDate(model.date).length > 0 ? window.style.accentColor : "transparent"
+ }
+ }
+ }
+ Rectangle {
+ z: -1
+ parent: calendar
+ anchors.fill: parent
+ border.color: window.style.frameColor
+ }
+ }
+
+ Component {
+ id: eventListHeader
+
+ Row {
+ id: eventDateRow
+ width: parent.width
+ height: eventDayLabel.height
+ spacing: 10
+
+ Label {
+ id: eventDayLabel
+ text: calendar.selectedDate.getDate()
+ font.pointSize: 35
+ }
+
+ Column {
+ height: eventDayLabel.height
+
+ Label {
+ readonly property var options: { weekday: "long" }
+ text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat)
+ font.pointSize: 18
+ }
+ Label {
+ text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth())
+ + calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy")
+ font.pointSize: 12
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ width: (parent.width > parent.height ? (parent.width - parent.spacing) * 0.4 : parent.width)
+ height: (parent.height > parent.width ? (parent.height - parent.spacing) * 0.4 : parent.height)
+ border.color: window.style.frameColor
+
+ ListView {
+ id: eventsListView
+ spacing: 4
+ clip: true
+ header: eventListHeader
+ anchors.fill: parent
+ anchors.margins: 10
+ model: eventModel.eventsForDate(calendar.selectedDate)
+
+ delegate: Rectangle {
+ width: eventsListView.width
+ height: eventItemColumn.height
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: "#eee"
+ }
+
+ Column {
+ id: eventItemColumn
+ x: 4
+ y: 4
+ width: parent.width - 8
+ height: timeRow.height + nameLabel.height + 8
+
+ Label {
+ id: nameLabel
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: modelData.name
+ }
+ Row {
+ id: timeRow
+ width: parent.width
+ Label {
+ text: modelData.start.toLocaleTimeString(calendar.locale, Locale.ShortFormat)
+ color: "#aaa"
+ }
+ Label {
+ text: "-" + new Date(modelData.end).toLocaleTimeString(calendar.locale, Locale.ShortFormat)
+ visible: modelData.start.getTime() !== modelData.end.getTime() && modelData.start.getDate() === modelData.end.getDate()
+ color: "#aaa"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro
new file mode 100644
index 00000000..b39b9aea
--- /dev/null
+++ b/examples/quick/controls/controls.pro
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ drawer \
+ mirroring \
+ styles \
+ tabs
diff --git a/examples/quick/controls/drawer/drawer.pro b/examples/quick/controls/drawer/drawer.pro
new file mode 100644
index 00000000..ed788c7e
--- /dev/null
+++ b/examples/quick/controls/drawer/drawer.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = drawer
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ drawer.qrc
diff --git a/examples/quick/controls/drawer/drawer.qrc b/examples/quick/controls/drawer/drawer.qrc
new file mode 100644
index 00000000..25cc5cbe
--- /dev/null
+++ b/examples/quick/controls/drawer/drawer.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/arrow.png</file>
+ <file>images/qt-logo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/drawer/images/arrow.png b/examples/quick/controls/drawer/images/arrow.png
new file mode 100644
index 00000000..4981e0de
--- /dev/null
+++ b/examples/quick/controls/drawer/images/arrow.png
Binary files differ
diff --git a/examples/quick/controls/drawer/images/qt-logo.png b/examples/quick/controls/drawer/images/qt-logo.png
new file mode 100644
index 00000000..cf350dad
--- /dev/null
+++ b/examples/quick/controls/drawer/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/controls/drawer/main.cpp b/examples/quick/controls/drawer/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/drawer/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/drawer/main.qml b/examples/quick/controls/drawer/main.qml
new file mode 100644
index 00000000..e60f6067
--- /dev/null
+++ b/examples/quick/controls/drawer/main.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+import QtQuick.Extras 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Drawer Example"
+
+ Rectangle {
+ id: content
+ anchors.fill: parent
+ anchors.margins: -1
+ border.color: window.style.frameColor
+
+ Image {
+ width: window.width / 2
+ height: window.height / 2
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: window.width > window.height ? width / 2 : 0
+ anchors.verticalCenterOffset: window.width < window.height ? -height / 4 : 0
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/qt-logo.png"
+ }
+
+ Image {
+ width: window.width / 2
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: height / 2
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/arrow.png"
+ }
+
+ transform: Translate {
+ x: effect.current === uncover ? drawer.position * listview.width :
+ effect.current === push ? drawer.position * listview.width * 0.5 : 0
+ }
+
+ z: effect.current === uncover ? 2 : 0
+ }
+
+ Drawer {
+ id: drawer
+ anchors.fill: parent
+
+ ListView {
+ id: listview
+
+ width: window.width / 3 * 2
+ height: window.height
+
+ ExclusiveGroup {
+ id: effect
+ }
+
+ model: VisualItemModel {
+ Label {
+ text: "Settings"
+ x: window.style.padding
+ width: parent.width - window.style.padding * 2
+ lineHeight: 2.0
+ color: window.style.accentColor
+ verticalAlignment: Text.AlignVCenter
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ Switch {
+ id: dim
+ text: "Dim"
+ checked: true
+ width: parent.width
+ layoutDirection: Qt.RightToLeft
+ enabled: effect.current != uncover
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ RadioButton {
+ id: overlay
+ text: "Overlay"
+ checked: true
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ RadioButton {
+ id: push
+ text: "Push"
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ RadioButton {
+ id: uncover
+ text: "Uncover"
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ }
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ anchors.topMargin: -1
+ anchors.bottomMargin: -1
+ border.color: window.style.frameColor
+ }
+
+ transform: Translate {
+ x: effect.current === uncover ? (1.0 - drawer.position) * listview.width : 0
+ }
+ }
+
+ background.visible: dim.checked
+
+ onClicked: close()
+ }
+}
diff --git a/examples/quick/controls/mirroring/main.cpp b/examples/quick/controls/mirroring/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/mirroring/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/mirroring/main.qml b/examples/quick/controls/mirroring/main.qml
new file mode 100644
index 00000000..535b9227
--- /dev/null
+++ b/examples/quick/controls/mirroring/main.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Mirroring Example"
+
+ ListView {
+ id: listview
+ anchors.fill: parent
+
+ LayoutMirroring.enabled: headerItem.mirror
+ LayoutMirroring.childrenInherit: true
+
+ headerPositioning: ListView.PullBackHeader
+ header: Rectangle {
+ property alias mirror: mirrorToggle.checked
+
+ z: 2
+ width: parent.width
+ height: label.implicitHeight + 96
+
+ Label {
+ id: label
+ text: "Beyond the essentials."
+ color: window.style.accentColor
+ anchors.fill: parent
+ anchors.margins: 48
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+
+ ToggleButton {
+ id: mirrorToggle
+ text: "Mirror"
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ layoutDirection: Qt.RightToLeft
+ LayoutMirroring.enabled: false
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ anchors.bottom: parent.bottom
+ color: window.style.frameColor
+ }
+ }
+
+ model: VisualItemModel {
+
+ Item { width: 1; height: 24 }
+
+ Flow {
+ id: flow
+ spacing: 12
+ width: Math.min(window.width, window.height) - 24
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ GroupBox {
+ title: "CheckBox"
+ readonly property real preferredWidth: (flow.width - 12) / 2
+ width: window.width > window.height || implicitWidth > preferredWidth ? flow.width : preferredWidth
+ ColumnLayout {
+ width: parent.width
+ CheckBox {
+ width: parent.width
+ text: "E-mail"
+ checked: true
+ }
+ CheckBox {
+ width: parent.width
+ text: "Calendar"
+ checked: true
+ }
+ CheckBox {
+ width: parent.width
+ text: "Contacts"
+ }
+ }
+ }
+
+ GroupBox {
+ title: "RadioButton"
+ readonly property real preferredWidth: (flow.width - 12) / 2
+ width: window.width > window.height || implicitWidth > preferredWidth ? flow.width : preferredWidth
+ ColumnLayout {
+ width: parent.width
+ ExclusiveGroup { id: eg }
+ RadioButton {
+ width: parent.width
+ text: "Portrait"
+ Exclusive.group: eg
+ }
+ RadioButton {
+ width: parent.width
+ text: "Landscape"
+ Exclusive.group: eg
+ }
+ RadioButton {
+ width: parent.width
+ text: "Automatic"
+ checked: true
+ Exclusive.group: eg
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Button"
+ width: flow.width
+ Row {
+ width: parent.width
+ spacing: window.style.spacing
+ readonly property real availableWidth: (flow.width - 12) / 2
+ readonly property real contentWidth: okButton.implicitWidth + cancelButton.implicitWidth + 12
+ readonly property real buttonWidth: contentWidth > availableWidth ? (width / 2 - spacing) : (width / 2 - 2 * spacing) / 2
+ Button {
+ id: okButton
+ text: "Ok"
+ width: parent.buttonWidth
+ }
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ width: parent.buttonWidth
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Switch"
+ width: flow.width
+ Column {
+ width: parent.width
+ Switch {
+ width: parent.width
+ text: "Wifi"
+ checked: true
+ }
+ Switch {
+ width: parent.width
+ text: "Bluetooth"
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ProgressBar"
+ width: flow.width
+ Column {
+ width: parent.width
+ spacing: window.style.spacing
+ ProgressBar {
+ width: parent.width
+ indeterminate: true
+ }
+ ProgressBar {
+ width: parent.width
+ value: slider.position
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Slider"
+ width: flow.width
+ Column {
+ width: parent.width
+ spacing: window.style.spacing
+ Slider {
+ id: slider
+ value: 0.4
+ width: parent.width
+ }
+ Slider {
+ width: parent.width
+ snapMode: AbstractSlider.SnapAlways
+ stepSize: 0.2
+ value: 0.8
+ }
+ }
+ }
+ }
+
+ Item { width: 1; height: 12 }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { anchors.right: parent.right }
+ }
+}
diff --git a/examples/quick/controls/mirroring/mirroring.pro b/examples/quick/controls/mirroring/mirroring.pro
new file mode 100644
index 00000000..3630b04b
--- /dev/null
+++ b/examples/quick/controls/mirroring/mirroring.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = mirroring
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ mirroring.qrc
diff --git a/examples/quick/controls/mirroring/mirroring.qrc b/examples/quick/controls/mirroring/mirroring.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/controls/mirroring/mirroring.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/styles/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/styles/main.qml b/examples/quick/controls/styles/main.qml
new file mode 100644
index 00000000..e0f66b17
--- /dev/null
+++ b/examples/quick/controls/styles/main.qml
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Styles Example"
+
+ header: ToolBar {
+ ToolButton {
+ label: Text {
+ text: "\u25C0"
+ color: enabled ? window.style.accentColor : window.style.frameColor
+ anchors.centerIn: parent
+ }
+ enabled: stackview.depth > 1
+ onClicked: stackview.pop()
+ }
+ }
+
+ StackView {
+ id: stackview
+ anchors.fill: parent
+ initialItem: pageComponent
+ }
+
+ Component {
+ id: pageComponent
+ Control {
+ id: page
+ style: Style {
+ padding: 6
+ roundness: roundedToggle.checked ? 3 : 0
+ accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0)
+ backgroundColor: darkButton.checked ? "#444" : "#fff"
+ frameColor: darkButton.checked ? "#666" : "#ccc"
+ textColor: darkButton.checked ? "#eee" : "#111"
+ pressColor: darkButton.checked ? "#33ffffff" : "#33333333"
+ baseColor: darkButton.checked ? "#444" : "#eee"
+ }
+ background: Rectangle {
+ color: style.backgroundColor
+ }
+ Flickable {
+ anchors.fill: parent
+ contentHeight: column.height + 48
+
+ Column {
+ id: column
+
+ x: (window.width - width) / 2
+ y: 24
+ width: window.width / 2
+ spacing: 12
+
+ Label {
+ text: "Code less. Create more."
+ color: page.style.accentColor
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+
+ Item { width: 1; height: 48 }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ Column {
+ spacing: 6
+ width: parent.width
+ Label {
+ text: "Accent color"
+ color: page.style.textColor
+ }
+ Slider {
+ id: colorSlider
+ width: parent.width
+ value: 0.275
+ //background: Rectangle { border.color: "red" }
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ ExclusiveGroup {
+ id: styleGroup
+ }
+
+ Column {
+ width: parent.width
+ spacing: 6
+ RadioButton {
+ id: lightButton
+ text: "Light"
+ width: parent.width
+ checked: true
+ layoutDirection: Qt.RightToLeft
+ Exclusive.group: styleGroup
+ //background: Rectangle { border.color: "red" }
+ }
+ RadioButton {
+ id: darkButton
+ text: "Dark"
+ width: parent.width
+ layoutDirection: Qt.RightToLeft
+ Exclusive.group: styleGroup
+ //background: Rectangle { border.color: "red" }
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ ToggleButton {
+ id: roundedToggle
+ width: parent.width
+ text: "Rounded corners"
+ layoutDirection: Qt.RightToLeft
+ checked: true
+ //background: Rectangle { border.color: "red" }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ Button {
+ text: "Push"
+ anchors.right: parent.right
+ onClicked: stackview.push(pageComponent)
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/styles/styles.pro b/examples/quick/controls/styles/styles.pro
new file mode 100644
index 00000000..f8fdec46
--- /dev/null
+++ b/examples/quick/controls/styles/styles.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = styles
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ styles.qrc
diff --git a/examples/quick/controls/styles/styles.qrc b/examples/quick/controls/styles/styles.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/controls/styles/styles.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/tabs/images/qt-logo.png b/examples/quick/controls/tabs/images/qt-logo.png
new file mode 100644
index 00000000..cf350dad
--- /dev/null
+++ b/examples/quick/controls/tabs/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/controls/tabs/main.cpp b/examples/quick/controls/tabs/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/tabs/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/tabs/main.qml b/examples/quick/controls/tabs/main.qml
new file mode 100644
index 00000000..96c7a6da
--- /dev/null
+++ b/examples/quick/controls/tabs/main.qml
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.XmlListModel 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Tabs Example"
+
+ TabView {
+ id: tabView
+
+ spacing: 1
+ anchors.fill: parent
+ background: Rectangle { color: style.frameColor }
+
+ Rectangle {
+ Tab.title: "Home"
+ anchors.fill: parent
+
+ Image {
+ id: logo
+ width: window.width / 2
+ height: window.height / 2
+ anchors.centerIn: parent
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/qt-logo.png"
+ }
+
+ Label {
+ text: "Things just got better"
+ color: window.style.accentColor
+ anchors.margins: 40
+ anchors.top: logo.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+ }
+
+ Rectangle {
+ Tab.title: "Discover"
+ anchors.fill: parent
+
+ ListView {
+ anchors.fill: parent
+ anchors.topMargin: -1
+ model: XmlListModel {
+ id: feedModel
+ query: "/rss/channel/item"
+ source: "http://blog.qt.io/feed/"
+ namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/';"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "pubDate"; query: "pubDate/string()" }
+ XmlRole { name: "creator"; query: "dc:creator/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ delegate: Item {
+ width: parent.width
+ height: feedItem.height
+ Column {
+ id: feedItem
+ width: parent.width
+ spacing: window.style.spacing
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ visible: index == 0
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.title
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ elide: Text.ElideRight
+ color: window.style.accentColor
+ font.pointSize: 20
+ lineHeight: 0.75
+ }
+ Label {
+ text: model.description
+ textFormat: Qt.RichText
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ wrapMode: Text.WordWrap
+ }
+ RowLayout {
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ spacing: window.style.spacing
+ Label {
+ text: model.creator
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ color: window.style.focusColor
+ font.pointSize: 8
+ }
+ Label {
+ text: model.pubDate
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ opacity: window.style.disabledOpacity
+ font.pointSize: 8
+ }
+ Item { Layout.fillWidth: true }
+ Button {
+ text: "Read more..."
+ onClicked: Qt.openUrlExternally(model.link)
+ }
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ }
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ running: feedModel.status === XmlListModel.Loading
+ }
+ }
+
+ Rectangle {
+ Tab.title: "Activity"
+ anchors.fill: parent
+
+ ListView {
+ anchors.fill: parent
+ anchors.topMargin: -1
+ model: XmlListModel {
+ id: commentModel
+ query: "/rss/channel/item"
+ source: "http://blog.qt.io/comments/feed/"
+ namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/';"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "pubDate"; query: "pubDate/string()" }
+ XmlRole { name: "creator"; query: "dc:creator/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ delegate: Rectangle {
+ width: parent.width
+ height: commentItem.height
+ Column {
+ id: commentItem
+ width: parent.width
+ spacing: window.style.spacing
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ visible: index == 0
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.title
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ elide: Text.ElideRight
+ color: window.style.accentColor
+ font.pointSize: 14
+ lineHeight: 0.75
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.description
+ textFormat: Qt.RichText
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ wrapMode: Text.WordWrap
+ }
+ RowLayout {
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ spacing: window.style.spacing
+ Label {
+ text: model.creator
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ color: window.style.focusColor
+ font.pointSize: 8
+ }
+ Label {
+ text: model.pubDate
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ opacity: window.style.disabledOpacity
+ font.pointSize: 8
+ }
+ Item { Layout.fillWidth: true }
+ Button {
+ text: "Read more..."
+ onClicked: Qt.openUrlExternally(model.link)
+ }
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ }
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ running: feedModel.status === XmlListModel.Loading
+ }
+ }
+ }
+
+ PageIndicator {
+ count: tabView.count
+ currentIndex: tabView.currentIndex
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quick/controls/tabs/tabs.pro b/examples/quick/controls/tabs/tabs.pro
new file mode 100644
index 00000000..2d9c3e0e
--- /dev/null
+++ b/examples/quick/controls/tabs/tabs.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = tabs
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ tabs.qrc
diff --git a/examples/quick/controls/tabs/tabs.qrc b/examples/quick/controls/tabs/tabs.qrc
new file mode 100644
index 00000000..b48259b1
--- /dev/null
+++ b/examples/quick/controls/tabs/tabs.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/qt-logo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro
new file mode 100644
index 00000000..80f94e86
--- /dev/null
+++ b/examples/quick/quick.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ calendar \
+ controls