diff --git a/examples/ApplicationTemplate/application.pro b/examples/ApplicationTemplate/application.pro new file mode 100644 index 0000000000000000000000000000000000000000..d623dff9033930ec085fe1d61d54aa4cef63922f --- /dev/null +++ b/examples/ApplicationTemplate/application.pro @@ -0,0 +1,17 @@ +QT += widgets qml quick +CONFIG += console +TARGET = application + +SOURCES += \ + main.cpp + +OTHER_FILES += \ + qml/main.qml + +RESOURCES += \ + resources.qrc + +MOC_DIR = ./.moc +OBJECTS_DIR = ./.obj +UI_DIR = ./.ui +RCC_DIR = ./.rcc diff --git a/examples/ApplicationTemplate/main.cpp b/examples/ApplicationTemplate/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e53c1340d48d6fda008d0b973bb729a968b48d84 --- /dev/null +++ b/examples/ApplicationTemplate/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets/QApplication> +#include <QtQml> +#include <QtQuick/QQuickView> + + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(QUrl("qrc:/qml/main.qml")); + if ( !component.isReady() ) { + qWarning("%s", qPrintable(component.errorString())); + return -1; + } + QObject *topLevel = component.create(); + QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); + if ( !window ) { + qWarning("Error: Your root item has to be a Window."); + return -1; + } + window->show(); + return app.exec(); +} diff --git a/examples/ApplicationTemplate/qml/images/qt_icon.png b/examples/ApplicationTemplate/qml/images/qt_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..229cdb006efcb67a291f46a52377bcd1d6172f44 Binary files /dev/null and b/examples/ApplicationTemplate/qml/images/qt_icon.png differ diff --git a/examples/ApplicationTemplate/qml/main.qml b/examples/ApplicationTemplate/qml/main.qml new file mode 100644 index 0000000000000000000000000000000000000000..23795f522d29ebca6c914aab3338667da063fc8c --- /dev/null +++ b/examples/ApplicationTemplate/qml/main.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $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 Digia Plc and its Subsidiary(-ies) 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 QtDesktop 1.0 + +ApplicationWindow { + width: 640 + height: 480 + minimumWidth: 400 + minimumHeight: 300 + + menuBar: MenuBar { + Menu { + text: "Menu 1" + MenuItem { text: "Item 1" } + MenuItem { text: "Item 2" } + } + Menu { + text: "Menu 2" + MenuItem { text: "Item 3" } + } + } + + toolBar: ToolBar { + RowLayout { + ToolButton { iconSource: "qrc:images/qt_icon.png" } + ToolButton { iconSource: "qrc:images/qt_icon.png" } + } + } + + SplitterRow { + anchors.fill: parent + handleWidth: 1 + TableView { + frame: false + highlightOnFocus: false + model: 40 + TableColumn { title: "Left Column" } + } + TextArea { + frame: false + highlightOnFocus: false + text: "Hello World" + } + } +} diff --git a/examples/ApplicationTemplate/resources.qrc b/examples/ApplicationTemplate/resources.qrc new file mode 100644 index 0000000000000000000000000000000000000000..dfdba433d19401660b3a541999ddcc092caef8cb --- /dev/null +++ b/examples/ApplicationTemplate/resources.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>qml/main.qml</file> + <file>qml/images/qt_icon.png</file> + </qresource> +</RCC>