summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/qtcreator/templates/qtquickapp/main.cpp10
-rw-r--r--share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp46
-rw-r--r--share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h1
-rw-r--r--src/plugins/qt4projectmanager/wizards/qtquickapp.cpp2
4 files changed, 17 insertions, 42 deletions
diff --git a/share/qtcreator/templates/qtquickapp/main.cpp b/share/qtcreator/templates/qtquickapp/main.cpp
index 82347f65b2..e906d7fa45 100644
--- a/share/qtcreator/templates/qtquickapp/main.cpp
+++ b/share/qtcreator/templates/qtquickapp/main.cpp
@@ -4,12 +4,12 @@
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
- viewer->addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
- viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
- viewer->setMainQmlFile(QLatin1String("qml/app/main.qml")); // MAINQML
- viewer->showExpanded();
+ QmlApplicationViewer viewer;
+ viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
+ viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
+ viewer.setMainQmlFile(QLatin1String("qml/app/main.qml")); // MAINQML
+ viewer.showExpanded();
return app->exec();
}
diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp
index 1bba248d97..448714fb52 100644
--- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp
@@ -11,10 +11,10 @@
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
+#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeComponent>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
-#include <QtGui/QApplication>
#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
@@ -49,12 +49,9 @@ static QmlJsDebuggingEnabler enableDebuggingHelper;
class QmlApplicationViewerPrivate
{
- QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {}
-
QString mainQmlFile;
- QDeclarativeView *view;
friend class QmlApplicationViewer;
- QString adjustPath(const QString &path);
+ static QString adjustPath(const QString &path);
};
QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
@@ -76,34 +73,17 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
: QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate(this))
+ , d(new QmlApplicationViewerPrivate())
{
connect(engine(), SIGNAL(quit()), SLOT(close()));
setResizeMode(QDeclarativeView::SizeRootObjectToView);
// Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
+ new QmlJSDebugger::JSDebuggerAgent(engine());
#endif
#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
-#endif
-#endif
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate(view))
-{
- connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
- view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
+ new QmlJSDebugger::QDeclarativeViewObserver(this, this);
#endif
#endif
}
@@ -115,22 +95,18 @@ QmlApplicationViewer::~QmlApplicationViewer()
QmlApplicationViewer *QmlApplicationViewer::create()
{
-#ifdef HARMATTAN_BOOSTER
- return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0);
-#else
return new QmlApplicationViewer();
-#endif
}
void QmlApplicationViewer::setMainQmlFile(const QString &file)
{
- d->mainQmlFile = d->adjustPath(file);
- d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile));
+ d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
}
void QmlApplicationViewer::addImportPath(const QString &path)
{
- d->view->engine()->addImportPath(d->adjustPath(path));
+ engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
}
void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
@@ -179,11 +155,11 @@ void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
void QmlApplicationViewer::showExpanded()
{
#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- d->view->showFullScreen();
+ showFullScreen();
#elif defined(Q_WS_MAEMO_5)
- d->view->showMaximized();
+ showMaximized();
#else
- d->view->show();
+ show();
#endif
}
diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h
index d6cb43e10e..7f06207113 100644
--- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h
+++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h
@@ -37,7 +37,6 @@ public:
void showExpanded();
private:
- explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent);
class QmlApplicationViewerPrivate *d;
};
diff --git a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
index a2cf2171fc..c9453a9073 100644
--- a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
@@ -466,7 +466,7 @@ QString QtQuickApp::componentSetDir(ComponentSet componentSet) const
}
}
-const int QtQuickApp::StubVersion = 18;
+const int QtQuickApp::StubVersion = 19;
} // namespace Internal
} // namespace Qt4ProjectManager