diff options
author | Tomasz Olszak <olszak.tomasz@gmail.com> | 2013-08-10 20:56:27 +0000 |
---|---|---|
committer | Tomasz Olszak <olszak.tomasz@gmail.com> | 2013-08-11 00:01:19 +0200 |
commit | 54f3de8fe38d0a1340466525955c6a9ba8ff1426 (patch) | |
tree | b6ab9f92d1e9cb6fe474e28cf8a8a87d21689943 | |
parent | bfd84c6a64f89f59e7120f45cabe5e30696a2910 (diff) | |
download | qtquickcontrols-tizen-54f3de8fe38d0a1340466525955c6a9ba8ff1426.tar.gz qtquickcontrols-tizen-54f3de8fe38d0a1340466525955c6a9ba8ff1426.tar.bz2 qtquickcontrols-tizen-54f3de8fe38d0a1340466525955c6a9ba8ff1426.zip |
Added Hello World example
Change-Id: I684db070bdf311e21de9d09e7967744dc9a3a2f2
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
-rw-r--r-- | examples/examples.pro | 2 | ||||
-rw-r--r-- | examples/helloworld/helloworld-default.qrc | 6 | ||||
-rw-r--r-- | examples/helloworld/helloworld-tizen.qrc | 5 | ||||
-rw-r--r-- | examples/helloworld/helloworld.pro | 29 | ||||
-rw-r--r-- | examples/helloworld/images/mainmenu.png | bin | 0 -> 30810 bytes | |||
-rw-r--r-- | examples/helloworld/main.cpp | 57 | ||||
-rw-r--r-- | examples/helloworld/main.qml | 61 | ||||
-rw-r--r-- | examples/helloworld/tizen/qt.conf | 6 |
8 files changed, 165 insertions, 1 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 1875716..4d691ae 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,3 +1,3 @@ TEMPLATE=subdirs -SUBDIRS+= touch twitter sensor-checker +SUBDIRS+= touch twitter sensor-checker helloworld diff --git a/examples/helloworld/helloworld-default.qrc b/examples/helloworld/helloworld-default.qrc new file mode 100644 index 0000000..7abd2c1 --- /dev/null +++ b/examples/helloworld/helloworld-default.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>images/mainmenu.png</file> + </qresource> +</RCC> diff --git a/examples/helloworld/helloworld-tizen.qrc b/examples/helloworld/helloworld-tizen.qrc new file mode 100644 index 0000000..a172726 --- /dev/null +++ b/examples/helloworld/helloworld-tizen.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qt/etc"> + <file alias="qt.conf">tizen/qt.conf</file> + </qresource> +</RCC> diff --git a/examples/helloworld/helloworld.pro b/examples/helloworld/helloworld.pro new file mode 100644 index 0000000..cda80b7 --- /dev/null +++ b/examples/helloworld/helloworld.pro @@ -0,0 +1,29 @@ +TEMPLATE=app + +tizen { + QMAKE_LFLAGS+=-pie -rdynamic + TARGET=QtHelloWorld.exe +} else { + TARGET=QtHelloWorld +} + +#under /opt/usr/apps/$APPID application will be installed +#you also need to add this in tizen/qt.conf file in Prefix entry +APPID=QtHelloWrl + +QT += qml quick + +OTHER_FILES += \ + main.qml \ + tizen/qt.conf + +SOURCES += \ + main.cpp + +RESOURCES += helloworld-default.qrc + +tizen: RESOURCES += helloworld-tizen.qrc + + + + diff --git a/examples/helloworld/images/mainmenu.png b/examples/helloworld/images/mainmenu.png Binary files differnew file mode 100644 index 0000000..405571c --- /dev/null +++ b/examples/helloworld/images/mainmenu.png diff --git a/examples/helloworld/main.cpp b/examples/helloworld/main.cpp new file mode 100644 index 0000000..f9d0e10 --- /dev/null +++ b/examples/helloworld/main.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com> + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +#include <QGuiApplication> +#include <QQuickWindow> +#include <QtDebug> +#include <QtGlobal> +#include <QQmlApplicationEngine> +#include <QScreen> +#include <QQuickItem> +extern "C" int OspMain(int argc, char *argv[]) +{ +#ifdef Q_OS_TIZEN_SIMULATOR + qputenv("QML_BAD_GUI_RENDER_LOOP","1"); +#endif + qputenv("QT_QUICK_CONTROLS_STYLE","Tizen"); + QGuiApplication app(argc,argv); + + QQmlApplicationEngine engine(QUrl("qrc:///main.qml")); + QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().at(0)); + if (window) { + window->setIcon(QIcon(":/images/mainmenu.png")); + window->show(); + return app.exec(); + } else { + qWarning() << "null window"; + return -1; + } +} + +int main(int argc, char *argv[]) { + return OspMain(argc,argv); +} diff --git a/examples/helloworld/main.qml b/examples/helloworld/main.qml new file mode 100644 index 0000000..50c09a8 --- /dev/null +++ b/examples/helloworld/main.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Tomasz Olszak. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 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 QtQuick 2.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Tizen 1.0 +import QtQuick.Window 2.0 + +ApplicationWindow { + id: appWindow + y: 60 + width: 720 + height: 1220 + + View { + id: content + anchors.fill: parent + + titleBar.text: qsTr("Hello World") + + backAction.onTriggered: Qt.quit() + } + +} diff --git a/examples/helloworld/tizen/qt.conf b/examples/helloworld/tizen/qt.conf new file mode 100644 index 0000000..df71e82 --- /dev/null +++ b/examples/helloworld/tizen/qt.conf @@ -0,0 +1,6 @@ +[Paths] +Prefix=/opt/usr/apps/QtHelloWrl +Libraries=lib +Binaries=bin +Plugins=data/plugins +Qml2Imports=data/qml |