aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlglobal_p.h
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@rim.com>2013-02-18 21:07:15 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-05 22:37:25 +0100
commitdfefcba06efc0ad239cb7f9ad5d9a5f9540841db (patch)
tree5e0bd8c615d672a2bac10a3dc22c970d5f1e3215 /src/qml/qml/qqmlglobal_p.h
parent23b7579e4d82e2c0a840b55adf7817ffb6b4389c (diff)
Add core application functionality to Qt.application in QML
This exposes some information to QML which is available on the QCoreApplication instance. A future change should make it possible to restrict this for use in scripting environments (which should not have access to the QCoreApplication). That has been left out of this change because proper support for such restrictions is not yet in place. Change-Id: Ica144fcfb0b42fa6df8d0cb1c7c03eb97282b489 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlglobal_p.h')
-rw-r--r--src/qml/qml/qqmlglobal_p.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index f6b2c81536..6ca54f65cd 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -313,6 +313,53 @@ public:
Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *);
Q_AUTOTEST_EXPORT QQmlGuiProvider *QQml_guiProvider();
+class QQmlApplicationPrivate;
+
+class Q_QML_PRIVATE_EXPORT QQmlApplication : public QObject
+{
+ //Application level logic, subclassed by QtQuick if available via QQmlGuiProvider
+ Q_OBJECT
+ Q_PROPERTY(QStringList arguments READ args CONSTANT)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString version READ version WRITE setVersion NOTIFY versionChanged)
+public:
+ QQmlApplication(QObject* parent=0);
+
+ QStringList args();
+
+ QString name() const;
+ QString version() const;
+
+public Q_SLOTS:
+ void setName(const QString &arg);
+ void setVersion(const QString &arg);
+
+Q_SIGNALS:
+ void aboutToQuit();
+
+ void nameChanged();
+ void versionChanged();
+
+protected:
+ QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=0);
+
+private:
+ Q_DISABLE_COPY(QQmlApplication);
+ Q_DECLARE_PRIVATE(QQmlApplication);
+};
+
+class QQmlApplicationPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQmlApplication)
+public:
+ QQmlApplicationPrivate() {
+ argsInit = false;
+ }
+
+ bool argsInit;
+ QStringList args;
+};
+
QT_END_NAMESPACE
#endif // QQMLGLOBAL_H