aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qml/conf.h
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@rim.com>2012-12-21 15:42:47 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-17 03:04:56 +0200
commit9aec6efd1f7e0c4922253163efc2e7ea7e751f0f (patch)
tree0dd84012338b6b8c4c2db235b7f06b6f7b568de1 /tools/qml/conf.h
parentf94c14821b5a4bede0ad1a5e41cb355880f87f97 (diff)
Add qml tool
This tool simply runs QML files using a QQmlApplicationEngine. It is configurable so as to behave, by default, like qmlscene in that it will automatically place non-Window QtQuick 2 Items inside a QQuickWindow with the size of the root item. The configuration is extensible so that other GUI scenes can also use it by altering the configuration files in their installation. On OS X, it is an app bundle, and handles the QFileOpenEvent so that it can be the tool with which qml files are usually launched by double-clicking. (This does not break the ability to use it on the command line too: the options still work, you just have to give the path to the executable inside the bundle.) Change-Id: I6bac813ce188be54842a78d7b532fcf2d54dc443 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tools/qml/conf.h')
-rw-r--r--tools/qml/conf.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/tools/qml/conf.h b/tools/qml/conf.h
new file mode 100644
index 0000000000..24ea44edb9
--- /dev/null
+++ b/tools/qml/conf.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CONF_H
+#define CONF_H
+
+#include <QtQml>
+#include <QObject>
+#include <QUrl>
+
+class PartialScene : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl container READ container WRITE setContainer NOTIFY containerChanged)
+ Q_PROPERTY(QString itemType READ itemType WRITE setItemType NOTIFY itemTypeChanged)
+public:
+ PartialScene(QObject *parent = 0) : QObject(parent)
+ {}
+
+ const QUrl container() const { return m_container; }
+ const QString itemType() const { return m_itemType; }
+
+ void setContainer(const QUrl &a) {
+ if (a==m_container)
+ return;
+ m_container = a;
+ emit containerChanged();
+ }
+ void setItemType(const QString &a) {
+ if (a==m_itemType)
+ return;
+ m_itemType = a;
+ emit itemTypeChanged();
+ }
+
+signals:
+ void containerChanged();
+ void itemTypeChanged();
+
+private:
+ QUrl m_container;
+ QString m_itemType;
+};
+
+class Config : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<PartialScene> sceneCompleters READ sceneCompleters)
+ Q_CLASSINFO("DefaultProperty", "sceneCompleters")
+public:
+ Config (QObject* parent=0) : QObject(parent)
+ {}
+
+ QQmlListProperty<PartialScene> sceneCompleters()
+ {
+ return QQmlListProperty<PartialScene>(this, completers);
+ }
+
+ QList<PartialScene*> completers;
+};
+
+#endif