diff options
Diffstat (limited to 'examples/quick/controls')
55 files changed, 1777 insertions, 399 deletions
diff --git a/examples/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml index 7e95b80b1..bc5ca214b 100644 --- a/examples/quick/controls/basiclayouts/main.qml +++ b/examples/quick/controls/basiclayouts/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Layouts 1.0 diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp index a757f4853..bb4b3bddb 100644 --- a/examples/quick/controls/basiclayouts/src/main.cpp +++ b/examples/quick/controls/basiclayouts/src/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/qml/main.qml b/examples/quick/controls/calendar/qml/main.qml index 8af5a6ca7..46215e28d 100644 --- a/examples/quick/controls/calendar/qml/main.qml +++ b/examples/quick/controls/calendar/qml/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/src/event.cpp b/examples/quick/controls/calendar/src/event.cpp index a54efa2b8..e4c7dd787 100644 --- a/examples/quick/controls/calendar/src/event.cpp +++ b/examples/quick/controls/calendar/src/event.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/src/event.h b/examples/quick/controls/calendar/src/event.h index eff210368..bfa11ad72 100644 --- a/examples/quick/controls/calendar/src/event.h +++ b/examples/quick/controls/calendar/src/event.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/src/main.cpp b/examples/quick/controls/calendar/src/main.cpp index effbb6ad1..6b3c058ab 100644 --- a/examples/quick/controls/calendar/src/main.cpp +++ b/examples/quick/controls/calendar/src/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/src/sqleventmodel.cpp b/examples/quick/controls/calendar/src/sqleventmodel.cpp index 6277a3165..95a62843a 100644 --- a/examples/quick/controls/calendar/src/sqleventmodel.cpp +++ b/examples/quick/controls/calendar/src/sqleventmodel.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/calendar/src/sqleventmodel.h b/examples/quick/controls/calendar/src/sqleventmodel.h index a2b72c072..ae0f3374f 100644 --- a/examples/quick/controls/calendar/src/sqleventmodel.h +++ b/examples/quick/controls/calendar/src/sqleventmodel.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro index f6696bc53..52ab8c459 100644 --- a/examples/quick/controls/controls.pro +++ b/examples/quick/controls/controls.pro @@ -5,10 +5,11 @@ SUBDIRS += \ tableview \ touch \ basiclayouts \ - styles + styles \ + uiforms qtHaveModule(widgets) { - SUBDIRS += texteditor + SUBDIRS += texteditor filesystembrowser } qtHaveModule(sql) { diff --git a/examples/quick/controls/filesystembrowser/filesystembrowser.pro b/examples/quick/controls/filesystembrowser/filesystembrowser.pro new file mode 100644 index 000000000..bf77d958f --- /dev/null +++ b/examples/quick/controls/filesystembrowser/filesystembrowser.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +TARGET = filesystembrowser +QT += qml quick widgets + +SOURCES += main.cpp + +RESOURCES += qml.qrc diff --git a/examples/quick/controls/filesystembrowser/main.cpp b/examples/quick/controls/filesystembrowser/main.cpp new file mode 100644 index 000000000..e64a9a227 --- /dev/null +++ b/examples/quick/controls/filesystembrowser/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 <QApplication> +#include <QQmlApplicationEngine> +#include <QtQml> +#include <QFileSystemModel> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QQmlApplicationEngine engine; + QFileSystemModel *fsm = new QFileSystemModel(&engine); + fsm->setRootPath(QDir::homePath()); + fsm->setResolveSymlinks(true); + engine.rootContext()->setContextProperty("fileSystemModel", fsm); + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + + return app.exec(); +} diff --git a/examples/quick/controls/filesystembrowser/main.qml b/examples/quick/controls/filesystembrowser/main.qml new file mode 100644 index 000000000..4b182b733 --- /dev/null +++ b/examples/quick/controls/filesystembrowser/main.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Controls 1.4 +import QtQml.Models 2.2 + +ApplicationWindow { + visible: true + width: 640 + height: 480 + title: qsTr("File System") + + menuBar: MenuBar { + Menu { + title: qsTr("File") + MenuItem { + text: qsTr("Exit") + onTriggered: Qt.quit(); + } + } + } + + Row { + id: row + anchors.top: parent.top + anchors.topMargin: 12 + anchors.horizontalCenter: parent.horizontalCenter + + ExclusiveGroup { + id: eg + } + + Repeater { + model: [ "None", "Single", "Extended", "Multi", "Contig."] + Button { + text: modelData + exclusiveGroup: eg + checkable: true + checked: index === 1 + onClicked: view.selectionMode = index + } + } + } + + ItemSelectionModel { + id: sel + model: fileSystemModel + onSelectionChanged: { + console.log("selected", selected) + console.log("deselected", deselected) + console.log("selection", sel.selection()) + } + onCurrentChanged: console.log("current", current) + } + + TreeView { + id: view + anchors.fill: parent + anchors.margins: 2 * 12 + row.height + model: fileSystemModel + selection: sel + + onCurrentIndexChanged: console.log("current index", currentIndex) + + TableViewColumn { + title: "Name" + role: "fileName" + resizable: true + } + + TableViewColumn { + title: "Permissions" + role: "filePermissions" + resizable: true + } + + onClicked: console.log("clicked", index) + onDoubleClicked: isExpanded(index) ? collapse(index) : expand(index) + } +} diff --git a/examples/quick/controls/filesystembrowser/qml.qrc b/examples/quick/controls/filesystembrowser/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/examples/quick/controls/filesystembrowser/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> diff --git a/examples/quick/controls/gallery/main.cpp b/examples/quick/controls/gallery/main.cpp index c456e1cb6..4c254a4ee 100644 --- a/examples/quick/controls/gallery/main.cpp +++ b/examples/quick/controls/gallery/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml index 2de810d8d..ab3d8d32a 100644 --- a/examples/quick/controls/gallery/main.qml +++ b/examples/quick/controls/gallery/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -49,6 +49,9 @@ ApplicationWindow { visible: true title: "Qt Quick Controls Gallery" + width: 640 + height: 480 + MessageDialog { id: aboutDialog icon: StandardIcon.Information diff --git a/examples/quick/controls/gallery/qml/+android/UI.js b/examples/quick/controls/gallery/qml/+android/UI.js index 6050d16ec..417b4581e 100644 --- a/examples/quick/controls/gallery/qml/+android/UI.js +++ b/examples/quick/controls/gallery/qml/+android/UI.js @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/gallery/qml/+ios/UI.js b/examples/quick/controls/gallery/qml/+ios/UI.js index 6050d16ec..417b4581e 100644 --- a/examples/quick/controls/gallery/qml/+ios/UI.js +++ b/examples/quick/controls/gallery/qml/+ios/UI.js @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/gallery/qml/+osx/UI.js b/examples/quick/controls/gallery/qml/+osx/UI.js index 2f078ea7f..ee439953c 100644 --- a/examples/quick/controls/gallery/qml/+osx/UI.js +++ b/examples/quick/controls/gallery/qml/+osx/UI.js @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/gallery/qml/ButtonPage.qml b/examples/quick/controls/gallery/qml/ButtonPage.qml index 0ed7e2d6a..b6db20de4 100644 --- a/examples/quick/controls/gallery/qml/ButtonPage.qml +++ b/examples/quick/controls/gallery/qml/ButtonPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -44,6 +44,8 @@ import QtQuick.Controls 1.2 ScrollView { id: page + implicitWidth: 640 + implicitHeight: 200 horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff diff --git a/examples/quick/controls/gallery/qml/InputPage.qml b/examples/quick/controls/gallery/qml/InputPage.qml index cb1878d02..660429671 100644 --- a/examples/quick/controls/gallery/qml/InputPage.qml +++ b/examples/quick/controls/gallery/qml/InputPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -44,6 +44,8 @@ import QtQuick.Controls 1.2 ScrollView { id: page + implicitWidth: 640 + implicitHeight: 400 horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff diff --git a/examples/quick/controls/gallery/qml/ProgressPage.qml b/examples/quick/controls/gallery/qml/ProgressPage.qml index a1fa596f7..416e936ae 100644 --- a/examples/quick/controls/gallery/qml/ProgressPage.qml +++ b/examples/quick/controls/gallery/qml/ProgressPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -44,6 +44,8 @@ import QtQuick.Controls 1.2 ScrollView { id: page + implicitWidth: 640 + implicitHeight: 400 horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff diff --git a/examples/quick/controls/gallery/qml/UI.js b/examples/quick/controls/gallery/qml/UI.js index 0286ac56a..819c34eec 100644 --- a/examples/quick/controls/gallery/qml/UI.js +++ b/examples/quick/controls/gallery/qml/UI.js @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/shared/qtquickcontrolsapplication.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h index a53400800..5f22b483f 100644 --- a/examples/quick/controls/shared/qtquickcontrolsapplication.h +++ b/examples/quick/controls/shared/qtquickcontrolsapplication.h @@ -1,31 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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:BSD$ +** 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$ ** diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp index 0193c4f93..1f6684a66 100644 --- a/examples/quick/controls/styles/main.cpp +++ b/examples/quick/controls/styles/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/styles/main.qml b/examples/quick/controls/styles/main.qml index e804b4a8b..b2eefb862 100644 --- a/examples/quick/controls/styles/main.qml +++ b/examples/quick/controls/styles/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -52,7 +52,7 @@ Window { visible: true title: qsTr("Styles Example") - property int columnWidth: window.width / 5 + property int columnFactor: 5 GridLayout { rowSpacing: 12 @@ -63,7 +63,7 @@ Window { Button { text: "Button" - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } Button { text: "Button" @@ -73,17 +73,17 @@ Window { border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 } } - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } Button { text: "Button" style: buttonStyle - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } TextField { Layout.row: 1 - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } TextField { style: TextFieldStyle { @@ -92,23 +92,23 @@ Window { border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 } } - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } TextField { style: textFieldStyle - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } Slider { id: slider1 Layout.row: 2 value: 0.5 - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } Slider { id: slider2 value: 0.5 - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor style: SliderStyle { groove: BorderImage { height: 6 @@ -139,40 +139,40 @@ Window { Slider { id: slider3 value: 0.5 - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor style: sliderStyle } ProgressBar { Layout.row: 3 value: slider1.value - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } ProgressBar { value: slider2.value - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor style: progressBarStyle } ProgressBar { value: slider3.value - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor style: progressBarStyle2 } CheckBox { text: "CheckBox" Layout.row: 4 - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } RadioButton { text: "RadioButton" - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } ComboBox { model: ["Paris", "Oslo", "New York"] - implicitWidth: columnWidth + implicitWidth: window.width / columnFactor } TabView { @@ -201,178 +201,197 @@ Window { // Style delegates: - property Component buttonStyle: ButtonStyle { - background: Rectangle { - implicitHeight: 22 - implicitWidth: columnWidth - color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc" - antialiasing: true - border.color: "gray" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" + Component { + id: buttonStyle + ButtonStyle { + + background: Rectangle { + implicitHeight: 22 + implicitWidth: window.width / columnFactor + color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc" antialiasing: true - visible: !control.pressed - border.color: "#aaffffff" + border.color: "gray" radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + visible: !control.pressed + border.color: "#aaffffff" + radius: height/2 + } } } } - property Component textFieldStyle: TextFieldStyle { - background: Rectangle { - implicitWidth: columnWidth - color: "#f0f0f0" - antialiasing: true - border.color: "gray" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" + Component { + id: textFieldStyle + TextFieldStyle { + background: Rectangle { + implicitWidth: window.width / columnFactor + color: "#f0f0f0" antialiasing: true - border.color: "#aaffffff" + border.color: "gray" radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#aaffffff" + radius: height/2 + } } } } - property Component sliderStyle: SliderStyle { - handle: Rectangle { - width: 18 - height: 18 - color: control.pressed ? "darkGray" : "lightGray" - border.color: "gray" - antialiasing: true - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" + Component { + id: sliderStyle + SliderStyle { + handle: Rectangle { + width: 18 + height: 18 + color: control.pressed ? "darkGray" : "lightGray" + border.color: "gray" antialiasing: true - border.color: "#eee" radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#eee" + radius: height/2 + } } - } - groove: Rectangle { - height: 8 - implicitWidth: columnWidth - implicitHeight: 22 + groove: Rectangle { + height: 8 + implicitWidth: window.width / columnFactor + implicitHeight: 22 - antialiasing: true - color: "#ccc" - border.color: "#777" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" antialiasing: true - border.color: "#66ffffff" + color: "#ccc" + border.color: "#777" radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#66ffffff" + radius: height/2 + } } } } - property Component progressBarStyle: ProgressBarStyle { - background: BorderImage { - source: "images/progress-background.png" - border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2 - } - progress: Item { - clip: true - BorderImage { - anchors.fill: parent - anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0 - source: "images/progress-fill.png" - border.left: 10 ; border.right: 10 - Rectangle { - width: 1 - color: "#a70" - opacity: 0.8 - anchors.top: parent.top + Component { + id: progressBarStyle + ProgressBarStyle { + background: BorderImage { + source: "images/progress-background.png" + border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2 + } + progress: Item { + clip: true + BorderImage { + anchors.fill: parent + anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0 + source: "images/progress-fill.png" + border.left: 10 ; border.right: 10 + Rectangle { + width: 1 + color: "#a70" + opacity: 0.8 + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: 1 + anchors.right: parent.right + visible: control.value < control.maximumValue + anchors.rightMargin: -parent.anchors.rightMargin + } + } + ParticleSystem { id: bubbles; running: visible } + ImageParticle { + id: fireball + system: bubbles + source: "images/bubble.png" + opacity: 0.7 + } + Emitter { + system: bubbles anchors.bottom: parent.bottom - anchors.bottomMargin: 1 + anchors.margins: 4 + anchors.bottomMargin: -4 + anchors.left: parent.left anchors.right: parent.right - visible: control.value < control.maximumValue - anchors.rightMargin: -parent.anchors.rightMargin + size: 4 + sizeVariation: 4 + acceleration: PointDirection { y: -6; xVariation: 3 } + emitRate: 6 * control.value + lifeSpan: 3000 } } - ParticleSystem { id: bubbles; running: visible } - ImageParticle { - id: fireball - system: bubbles - source: "images/bubble.png" - opacity: 0.7 - } - Emitter { - system: bubbles - anchors.bottom: parent.bottom - anchors.margins: 4 - anchors.bottomMargin: -4 - anchors.left: parent.left - anchors.right: parent.right - size: 4 - sizeVariation: 4 - acceleration: PointDirection { y: -6; xVariation: 3 } - emitRate: 6 * control.value - lifeSpan: 3000 - } } } - property Component progressBarStyle2: ProgressBarStyle { - background: Rectangle { - implicitWidth: columnWidth - implicitHeight: 24 - color: "#f0f0f0" - border.color: "gray" - } - progress: Rectangle { - color: "#ccc" - border.color: "gray" - Rectangle { - color: "transparent" - border.color: "#44ffffff" - anchors.fill: parent - anchors.margins: 1 + Component { + id: progressBarStyle2 + ProgressBarStyle { + background: Rectangle { + implicitWidth: window.width / columnFactor + implicitHeight: 24 + color: "#f0f0f0" + border.color: "gray" + } + progress: Rectangle { + color: "#ccc" + border.color: "gray" + Rectangle { + color: "transparent" + border.color: "#44ffffff" + anchors.fill: parent + anchors.margins: 1 + } } } } - property Component tabViewStyle: TabViewStyle { - tabOverlap: 16 - frameOverlap: 4 - tabsMovable: true + Component { + id: tabViewStyle + TabViewStyle { + tabOverlap: 16 + frameOverlap: 4 + tabsMovable: true - frame: Rectangle { - gradient: Gradient { - GradientStop { color: "#e5e5e5" ; position: 0 } - GradientStop { color: "#e0e0e0" ; position: 1 } - } - border.color: "#898989" - Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" } - } - tab: Item { - property int totalOverlap: tabOverlap * (control.count - 1) - implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width) - implicitHeight: image.sourceSize.height - BorderImage { - id: image - anchors.fill: parent - source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" - border.left: 30 - smooth: false - border.right: 30 + frame: Rectangle { + gradient: Gradient { + GradientStop { color: "#e5e5e5" ; position: 0 } + GradientStop { color: "#e0e0e0" ; position: 1 } + } + border.color: "#898989" + Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" } } - Text { - text: styleData.title - anchors.centerIn: parent + tab: Item { + property int totalOverlap: tabOverlap * (control.count - 1) + implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width) + implicitHeight: image.sourceSize.height + BorderImage { + id: image + anchors.fill: parent + source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" + border.left: 30 + smooth: false + border.right: 30 + } + Text { + text: styleData.title + anchors.centerIn: parent + } } + leftCorner: Item { implicitWidth: 12 } } - leftCorner: Item { implicitWidth: 12 } } } diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml index 49386289d..1d99f4b93 100644 --- a/examples/quick/controls/tableview/main.qml +++ b/examples/quick/controls/tableview/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/tableview/src/main.cpp b/examples/quick/controls/tableview/src/main.cpp index 1406b84ce..dbba7f38c 100644 --- a/examples/quick/controls/tableview/src/main.cpp +++ b/examples/quick/controls/tableview/src/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp b/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp index 7b999470f..f362d5d3d 100644 --- a/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp +++ b/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/tableview/src/sortfilterproxymodel.h b/examples/quick/controls/tableview/src/sortfilterproxymodel.h index 026b5d124..c4460b0f1 100644 --- a/examples/quick/controls/tableview/src/sortfilterproxymodel.h +++ b/examples/quick/controls/tableview/src/sortfilterproxymodel.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml b/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml index b69849762..a225e2eaa 100644 --- a/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml +++ b/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml index 26e22e984..cefbf4349 100644 --- a/examples/quick/controls/texteditor/qml/main.qml +++ b/examples/quick/controls/texteditor/qml/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -157,8 +157,13 @@ ApplicationWindow { FileDialog { id: fileDialog - nameFilters: ["Text files (*.txt)", "HTML files (*.html)"] - onAccepted: document.fileUrl = fileUrl + nameFilters: ["Text files (*.txt)", "HTML files (*.html, *.htm)"] + onAccepted: { + if (fileDialog.selectExisting) + document.fileUrl = fileUrl + else + document.saveAs(fileUrl, selectedNameFilter) + } } ColorDialog { @@ -172,13 +177,28 @@ ApplicationWindow { iconSource: "images/fileopen.png" iconName: "document-open" text: "Open" - onTriggered: fileDialog.open() + onTriggered: { + fileDialog.selectExisting = true + fileDialog.open() + } + } + + Action { + id: fileSaveAsAction + iconSource: "images/filesave.png" + iconName: "document-save" + text: "Save As…" + onTriggered: { + fileDialog.selectExisting = false + fileDialog.open() + } } menuBar: MenuBar { Menu { title: "&File" MenuItem { action: fileOpenAction } + MenuItem { action: fileSaveAsAction } MenuItem { text: "Quit"; onTriggered: Qt.quit() } } Menu { @@ -303,6 +323,10 @@ ApplicationWindow { Component.onCompleted: forceActiveFocus() } + MessageDialog { + id: errorDialog + } + DocumentHandler { id: document target: textArea @@ -325,5 +349,9 @@ ApplicationWindow { fontFamilyComboBox.special = false } } + onError: { + errorDialog.text = message + errorDialog.visible = true + } } } diff --git a/examples/quick/controls/texteditor/src/documenthandler.cpp b/examples/quick/controls/texteditor/src/documenthandler.cpp index e0c9610d0..2e9987a1e 100644 --- a/examples/quick/controls/texteditor/src/documenthandler.cpp +++ b/examples/quick/controls/texteditor/src/documenthandler.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -119,6 +119,24 @@ void DocumentHandler::setText(const QString &arg) } } +void DocumentHandler::saveAs(const QUrl &arg, const QString &fileType) +{ + bool isHtml = fileType.contains(QLatin1String("htm")); + QLatin1String ext(isHtml ? ".html" : ".txt"); + QString localPath = arg.toLocalFile(); + if (!localPath.endsWith(ext)) + localPath += ext; + QFile f(localPath); + if (!f.open(QFile::WriteOnly | QFile::Truncate | (isHtml ? QFile::NotOpen : QFile::Text))) { + emit error(tr("Cannot save: ") + f.errorString()); + return; + } + f.write((isHtml ? m_doc->toHtml() : m_doc->toPlainText()).toLocal8Bit()); + f.close(); + qDebug() << "saved to" << localPath; + setFileUrl(QUrl::fromLocalFile(localPath)); +} + QUrl DocumentHandler::fileUrl() const { return m_fileUrl; diff --git a/examples/quick/controls/texteditor/src/documenthandler.h b/examples/quick/controls/texteditor/src/documenthandler.h index a759c4033..f2bd4eead 100644 --- a/examples/quick/controls/texteditor/src/documenthandler.h +++ b/examples/quick/controls/texteditor/src/documenthandler.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -122,6 +122,7 @@ public Q_SLOTS: void setFileUrl(const QUrl &arg); void setText(const QString &arg); + void saveAs(const QUrl &arg, const QString &fileType); void setDocumentTitle(QString arg); @@ -146,6 +147,7 @@ Q_SIGNALS: void textChanged(); void documentTitleChanged(); + void error(QString message); private: void reset(); diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp index ea7d22de3..160e6a9a1 100644 --- a/examples/quick/controls/texteditor/src/main.cpp +++ b/examples/quick/controls/texteditor/src/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/touch/content/AndroidDelegate.qml b/examples/quick/controls/touch/content/AndroidDelegate.qml index 21ee8e680..07f288337 100644 --- a/examples/quick/controls/touch/content/AndroidDelegate.qml +++ b/examples/quick/controls/touch/content/AndroidDelegate.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 Item { diff --git a/examples/quick/controls/touch/content/ButtonPage.qml b/examples/quick/controls/touch/content/ButtonPage.qml index f7f541bc5..3888e30d5 100644 --- a/examples/quick/controls/touch/content/ButtonPage.qml +++ b/examples/quick/controls/touch/content/ButtonPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/content/ListPage.qml b/examples/quick/controls/touch/content/ListPage.qml index 4e2dbeb84..f12b0c12b 100644 --- a/examples/quick/controls/touch/content/ListPage.qml +++ b/examples/quick/controls/touch/content/ListPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/content/ProgressBarPage.qml b/examples/quick/controls/touch/content/ProgressBarPage.qml index efcec5ee9..5190b4bba 100644 --- a/examples/quick/controls/touch/content/ProgressBarPage.qml +++ b/examples/quick/controls/touch/content/ProgressBarPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/content/SliderPage.qml b/examples/quick/controls/touch/content/SliderPage.qml index f69318001..4f4e2ee82 100644 --- a/examples/quick/controls/touch/content/SliderPage.qml +++ b/examples/quick/controls/touch/content/SliderPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/content/TabBarPage.qml b/examples/quick/controls/touch/content/TabBarPage.qml index 3ffd45baa..a27bb2069 100644 --- a/examples/quick/controls/touch/content/TabBarPage.qml +++ b/examples/quick/controls/touch/content/TabBarPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/content/TextInputPage.qml b/examples/quick/controls/touch/content/TextInputPage.qml index c0e60d62e..3c4dc4ade 100644 --- a/examples/quick/controls/touch/content/TextInputPage.qml +++ b/examples/quick/controls/touch/content/TextInputPage.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** @@ -38,10 +38,6 @@ ** ****************************************************************************/ - - - - import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml index 4efea3cbb..5138fa0ca 100644 --- a/examples/quick/controls/touch/main.qml +++ b/examples/quick/controls/touch/main.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp index a757f4853..bb4b3bddb 100644 --- a/examples/quick/controls/touch/src/main.cpp +++ b/examples/quick/controls/touch/src/main.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -17,8 +17,8 @@ ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived +** * 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. ** ** diff --git a/examples/quick/controls/uiforms/MainForm.ui.qml b/examples/quick/controls/uiforms/MainForm.ui.qml new file mode 100644 index 000000000..4649209f4 --- /dev/null +++ b/examples/quick/controls/uiforms/MainForm.ui.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.2 + +Item { + width: 800 + height: 480 + property alias tableView: tableView + + SplitView { + id: splitView + anchors.fill: parent + + TableView { + id: tableView + + property int columnWidth: width / 3 + Layout.minimumWidth: splitView.width / 3 + + TableViewColumn { + role: "customerId" + title: qsTr("Customer Id") + width: tableView.columnWidth + } + + TableViewColumn { + role: "firstName" + title: qsTr("First Name") + width: tableView.columnWidth + } + TableViewColumn { + role: "lastName" + title: qsTr("Last Name") + width: tableView.columnWidth + } + } + + TabView { + id: tabView + + Layout.minimumWidth: 480 + + Tab { + title: qsTr("Customer Settings") + source: "qml/Settings.qml" + } + Tab { + title: qsTr("Customer Notes") + source: "qml/Notes.qml" + } + Tab { + title: qsTr("Customer History") + source: "qml/History.qml" + } + } + } +} diff --git a/examples/quick/controls/uiforms/main.cpp b/examples/quick/controls/uiforms/main.cpp new file mode 100644 index 000000000..de92dd709 --- /dev/null +++ b/examples/quick/controls/uiforms/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include <QtQml> +#include <QtGui/QSurfaceFormat> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + + qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/CustomerModel.qml")), "io.qt.example", 1, 0, "CustomerModel"); + + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/uiforms/main.qml b/examples/quick/controls/uiforms/main.qml new file mode 100644 index 000000000..da2580225 --- /dev/null +++ b/examples/quick/controls/uiforms/main.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 +import "qml" + +ApplicationWindow { + visible: true + title: "Qt Quick UI Forms" + + MessageDialog { + id: aboutDialog + icon: StandardIcon.Information + title: qsTr("About") + text: "Qt Quick UI Forms" + informativeText: qsTr("This example demonstrates how to separate the implementation of an application from the UI using ui.qml files.") + } + + Action { + id: copyAction + text: qsTr("&Copy") + shortcut: StandardKey.Copy + iconName: "edit-copy" + enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) + onTriggered: activeFocusItem.copy() + } + + Action { + id: cutAction + text: qsTr("Cu&t") + shortcut: StandardKey.Cut + iconName: "edit-cut" + enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) + onTriggered: activeFocusItem.cut() + } + + Action { + id: pasteAction + text: qsTr("&Paste") + shortcut: StandardKey.Paste + iconName: "edit-paste" + enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) + onTriggered: activeFocusItem.paste() + } + + menuBar: MenuBar { + Menu { + title: qsTr("&File") + MenuItem { + text: qsTr("E&xit") + shortcut: StandardKey.Quit + onTriggered: Qt.quit() + } + } + Menu { + title: qsTr("&Edit") + MenuItem { + action: cutAction + } + MenuItem { + action: copyAction + } + MenuItem { + action: pasteAction + } + } + Menu { + title: qsTr("&Help") + MenuItem { + text: qsTr("About...") + onTriggered: aboutDialog.open() + } + } + } + + MainForm { + id: mainForm + + anchors.fill: parent + + Layout.minimumWidth: 800 + Layout.minimumHeight: 480 + Layout.preferredWidth: 768 + Layout.preferredHeight: 480 + + tableView.model: CustomerModel + + Component.onCompleted: CustomerModel.selection = tableView.selection + } +} diff --git a/examples/quick/controls/uiforms/qml/CustomerModel.qml b/examples/quick/controls/uiforms/qml/CustomerModel.qml new file mode 100644 index 000000000..70a9695dd --- /dev/null +++ b/examples/quick/controls/uiforms/qml/CustomerModel.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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$ +** +****************************************************************************/ + +pragma Singleton + +import QtQuick 2.0 + +ListModel { + property QtObject selection + ListElement { + customerId: "15881123" + firstName: "Julia" + title: "Ms." + lastName: "Jefferson" + email: "Julia@example.com" + address: "Spandia Avenue, Suite 610" + city: "Toronto" + zipCode: "92334" + phoneNumber: "0803-033330" + notes: "Very demanding customer." + history: "21.4.2014|Order|coffee~23.4.2014|Order|poster~29.4.2014|Invoice|poster 40$~05.5.2014|Overdue Notice|poster 40$" + } + + ListElement { + customerId: "29993496" + firstName: "Tim" + lastName: "Northington" + title: "Mr." + email: "Northington@example.com" + address: "North Fifth Street 55" + city: "San Jose" + zipCode: "95112" + phoneNumber: "09000-3330" + notes: "Very good customer." + history: "18.4.2014|Order|orange juice~23.4.2014|Order|chair~24.4.2014|Complaint|Chair is broken." + } + + ListElement { + customerId: "37713567" + firstName: "Daniel" + lastName: "Krumm" + title: "Mr." + email: "Krumm@example.com" + address: "Waterfront 14" + city: "Berlin" + zipCode: "12334" + phoneNumber: "0708093330" + notes: "This customer has a lot of Complaintts." + history: "15.4.2014|Order|table~25.4.2014|Return|table~28.4.2014|Complaint|Table had wrong color." + } + + ListElement { + customerId: "45817387" + firstName: "Sandra" + lastName: "Booth" + title: "Ms." + email: "Sandrab@example.com" + address: "Folsom Street 23" + city: "San Francisco" + zipCode: "94103" + phoneNumber: "0103436370" + notes: "This customer is not paying." + history: "22.4.2014|Order|coffee~23.4.2014|Order|smartphone~29.4.2014|Invoice|smartphone 200$~05.5.2014|Overdue Notice|smartphone 200$" + } + + ListElement { + customerId: "588902396" + firstName: "Lora" + lastName: "Beckner" + title: "Ms." + email: "LoraB@example.com" + address: " W Wilson Apt 3" + city: "Los Angeles" + zipCode: "90086" + phoneNumber: "0903436360" + notes: "This customer usually pays late." + history: "17.4.2014|Order|soft drink~23.4.2014|Order|computer~29.4.2014|Invoice|computer 1200$~07.5.2014|Overdue Notice|computer 1200$" + } + + ListElement { + customerId: "67873693" + firstName: "Daniel" + lastName: "Krumm" + title: "Mr." + email: "Krumm@example.com" + address: "Waterfront 14" + city: "Berlin" + zipCode: "12334" + phoneNumber: "0303033330" + notes: "This customer has a lot of Complaints." + history: "23.4.2014|Order|jacket~25.4.2014|Return|jacket~28.4.2014|Complaint|Jacket had wrong color." + } + + ListElement { + customerId: "78885693" + firstName: "Vanessa" + lastName: "Newbury" + title: "Ms." + email: "VanessaN@example.com" + address: "Madison Ave. 277" + city: "New York" + zipCode: "10016" + phoneNumber: "0503053530" + notes: "Deliveries sometime do not arrive on time." + history: "19.4.2014|Order|coffee~23.4.2014|Order|bicycle~29.4.2014|Invoice|bicycle 500$~06.5.2014|Overdue Notice|bicycle 500$" + } +} diff --git a/examples/quick/controls/uiforms/qml/History.qml b/examples/quick/controls/uiforms/qml/History.qml new file mode 100644 index 000000000..336d717ff --- /dev/null +++ b/examples/quick/controls/uiforms/qml/History.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 + +HistoryForm { + id: form + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + + var history = CustomerModel.get(rowIndex).history + var entries = history.split("~") + + form.tableView.model.clear() + + var index + for (index = 0; index < entries.length; index++) { + var entry = entries[index] + var data = entry.split("|") + form.tableView.model.append({ + date: data[0], + type: data[1], + text: data[2] + }) + } + }) + } + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml new file mode 100644 index 000000000..9445b12fb --- /dev/null +++ b/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + width: 640 + height: 480 + property alias tableView: tableView + + TableView { + id: tableView + + property int columnWidth: width / 3 + + anchors.fill: parent + + TableViewColumn { + role: "date" + title: qsTr("Date") + width: tableView.columnWidth + } + + TableViewColumn { + role: "type" + title: qsTr("Type") + width: tableView.columnWidth + } + + TableViewColumn { + role: "text" + title: qsTr("Description") + width: tableView.columnWidth + } + + model: ListModel { + } + } +} diff --git a/examples/quick/controls/uiforms/qml/Notes.qml b/examples/quick/controls/uiforms/qml/Notes.qml new file mode 100644 index 000000000..af506af31 --- /dev/null +++ b/examples/quick/controls/uiforms/qml/Notes.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 + +NotesForm { + id: form + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + form.textArea.text = CustomerModel.get(rowIndex).notes + }) + + save.enabled = true + cancel.enabled = true + form.textArea.enabled = true + } + + function writeData() { + CustomerModel.selection.forEach(function (rowIndex) { + var data = CustomerModel.get(rowIndex) + data.notes = form.textArea.text + CustomerModel.set(rowIndex, data) + }) + } + + cancel.onClicked: readData() + save.onClicked: writeData() + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quick/controls/uiforms/qml/NotesForm.ui.qml b/examples/quick/controls/uiforms/qml/NotesForm.ui.qml new file mode 100644 index 000000000..9552afcd0 --- /dev/null +++ b/examples/quick/controls/uiforms/qml/NotesForm.ui.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + property alias cancel: cancel + property alias save: save + property alias textArea: textArea + + width: 640 + height: 480 + + ColumnLayout { + anchors.rightMargin: 12 + anchors.leftMargin: 12 + anchors.bottomMargin: 12 + anchors.topMargin: 12 + anchors.fill: parent + + TextArea { + id: textArea + x: 8 + y: 8 + width: 624 + height: 320 + Layout.fillHeight: true + Layout.fillWidth: true + } + RowLayout { + Layout.alignment: Qt.AlignTop | Qt.AlignRight + Button { + id: save + text: qsTr("Save") + enabled: false + } + Button { + id: cancel + text: qsTr("Cancel") + enabled: false + } + } + } +} diff --git a/examples/quick/controls/uiforms/qml/Settings.qml b/examples/quick/controls/uiforms/qml/Settings.qml new file mode 100644 index 000000000..658c62d3c --- /dev/null +++ b/examples/quick/controls/uiforms/qml/Settings.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 +import io.qt.example 1.0 + +SettingsForm { + id: form + anchors.fill: parent + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + form.firstName.text = CustomerModel.get(rowIndex).firstName + form.lastName.text = CustomerModel.get(rowIndex).lastName + form.customerId.text = CustomerModel.get(rowIndex).customerId + form.email.text = CustomerModel.get(rowIndex).email + form.address.text = CustomerModel.get(rowIndex).address + form.phoneNumber.text = CustomerModel.get(rowIndex).phoneNumber + form.zipCode.text = CustomerModel.get(rowIndex).zipCode + form.city.text = CustomerModel.get(rowIndex).city + form.title.currentIndex = form.title.find(CustomerModel.get(rowIndex).title) + }) + + save.enabled = true + cancel.enabled = true + gridLayout.enabled = true + } + + function writeData() { + CustomerModel.selection.forEach(function (rowIndex) { + var notes = CustomerModel.get(rowIndex).notes + CustomerModel.set(rowIndex, { + firstName: form.firstName.text, + lastName: form.lastName.text, + customerId: form.customerId.text, + email: form.firstName.email, + address: form.lastName.address, + phoneNumber: form.customerId.phoneNumber, + zipCode: form.customerId.zipCode, + city: form.customerId.city, + title: form.title.currentText, + notes: notes + }) + }) + } + + cancel.onClicked: readData() + save.onClicked: writeData() + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml new file mode 100644 index 000000000..5cafe0e7a --- /dev/null +++ b/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml @@ -0,0 +1,259 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + width: 480 + height: 480 + + property alias address: address + property alias gridLayout: gridLayout + property alias cancel: cancel + property alias save: save + + property alias title: title + property alias zipCode: zipCode + property alias city: city + property alias phoneNumber: phoneNumber + property alias customerId: customerId + property alias email: email + property alias lastName: lastName + property alias firstName: firstName + + GridLayout { + id: gridLayout + + anchors.right: parent.right + anchors.left: parent.left + anchors.top: parent.top + anchors.rightMargin: 12 + anchors.leftMargin: 12 + anchors.topMargin: 12 + columnSpacing: 8 + rowSpacing: 8 + rows: 8 + columns: 7 + enabled: false + + Label { + id: label1 + text: qsTr("Title") + Layout.columnSpan: 2 + } + + Label { + id: label2 + text: qsTr("First Name") + Layout.columnSpan: 2 + } + + Item { + id: spacer10 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + Label { + id: label3 + text: qsTr("Last Name") + } + + Item { + id: spacer15 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + ComboBox { + id: title + Layout.columnSpan: 2 + Layout.fillWidth: true + model: ["Mr.", "Ms."] + } + + TextField { + id: firstName + Layout.minimumWidth: 140 + Layout.fillWidth: true + Layout.columnSpan: 3 + placeholderText: qsTr("first name") + } + + TextField { + id: lastName + Layout.minimumWidth: 140 + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("last name") + } + + Label { + id: label4 + text: qsTr("Phone Number") + Layout.columnSpan: 5 + } + + Label { + id: label5 + text: qsTr("Email") + Layout.preferredHeight: 13 + Layout.preferredWidth: 24 + } + + Item { + id: spacer16 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: phoneNumber + Layout.fillWidth: true + Layout.columnSpan: 5 + placeholderText: qsTr("phone number") + } + + TextField { + id: email + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("email") + } + + Label { + id: label6 + text: qsTr("Address") + } + + Item { + id: spacer3 + Layout.columnSpan: 6 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: address + Layout.fillWidth: true + Layout.columnSpan: 7 + placeholderText: qsTr("address") + } + + Label { + id: label7 + text: qsTr("City") + } + + Item { + id: spacer4 + Layout.columnSpan: 4 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + Label { + id: label8 + text: qsTr("Zip Code") + } + + Item { + id: spacer18 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: city + Layout.fillWidth: true + Layout.columnSpan: 5 + placeholderText: qsTr("city") + } + + TextField { + id: zipCode + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("zip code") + } + + Label { + id: label9 + text: qsTr("Customer Id") + } + + Item { + id: spacer19 + Layout.columnSpan: 6 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: customerId + Layout.columnSpan: 7 + Layout.fillWidth: true + placeholderText: qsTr("id") + } + } + + RowLayout { + anchors.topMargin: 12 + anchors.right: parent.right + anchors.rightMargin: 12 + anchors.top: gridLayout.bottom + + Button { + id: save + text: qsTr("Save") + enabled: false + } + + Button { + id: cancel + text: qsTr("Cancel") + enabled: false + } + } +} diff --git a/examples/quick/controls/uiforms/uiforms.pro b/examples/quick/controls/uiforms/uiforms.pro new file mode 100644 index 000000000..08b3d0c4a --- /dev/null +++ b/examples/quick/controls/uiforms/uiforms.pro @@ -0,0 +1,21 @@ +TEMPLATE = app +TARGET = uiforms + +SOURCES += \ + main.cpp + +RESOURCES += \ + uiforms.qrc + +OTHER_FILES += \ + main.qml \ + MainForm.ui.qml \ + qml/Settings.qml \ + qml/History.qml \ + qml/Notes.qml \ + qml/SettingsForm.ui.qml \ + qml/HistoryForm.ui.qml \ + qml/NotesForm.ui.qml \ + qml/CustomerModel.qml + +include(../shared/shared.pri) diff --git a/examples/quick/controls/uiforms/uiforms.qrc b/examples/quick/controls/uiforms/uiforms.qrc new file mode 100644 index 000000000..447bb039d --- /dev/null +++ b/examples/quick/controls/uiforms/uiforms.qrc @@ -0,0 +1,13 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>MainForm.ui.qml</file> + <file>qml/Settings.qml</file> + <file>qml/History.qml</file> + <file>qml/Notes.qml</file> + <file>qml/SettingsForm.ui.qml</file> + <file>qml/HistoryForm.ui.qml</file> + <file>qml/NotesForm.ui.qml</file> + <file>qml/CustomerModel.qml</file> + </qresource> +</RCC> |
