summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-04 10:34:08 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-08-05 10:46:12 +0200
commit8f3b218099d9f1d9aa4ae58474430f864a8758ef (patch)
treef48d70803a3b9e5fe3c4f879d8b90a5919f8fde4 /tools
parenta61337b33ae1a3ee2df1570da30880e8fe9237e9 (diff)
Make QSGCanvas a QWindow instead of a QGLWidget
Change-Id: I71a04f61acff893a35c00204ed11bdf852830485 Reviewed-on: http://codereview.qt.nokia.com/2675 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlscene/main.cpp94
-rw-r--r--tools/tools.pro4
2 files changed, 23 insertions, 75 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 705854a6fd..95b1059943 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -144,36 +144,13 @@ void RenderStatistics::printTotalStats()
}
#endif
-
-static QGLFormat getFormat()
-{
- QGLFormat f = QGLFormat::defaultFormat();
- f.setSampleBuffers(!qApp->arguments().contains("--no-multisample"));
- f.setSwapInterval(qApp->arguments().contains("--nonblocking-swap") ? 0 : 1);
- f.setStereo(qApp->arguments().contains("--stereo"));
- return f;
-}
-
class MyQSGView : public QSGView
{
public:
- MyQSGView() : QSGView(getFormat())
+ MyQSGView() : QSGView()
{
setResizeMode(QSGView::SizeRootObjectToView);
}
-
-protected:
- void paintEvent(QPaintEvent *e) {
- QSGView::paintEvent(e);
-
-#ifdef QML_RUNTIME_TESTING
-// RenderStatistics::updateStats();
-#endif
-
- static bool continuousUpdate = qApp->arguments().contains("--continuous-update");
- if (continuousUpdate)
- update();
- }
};
class MyDeclarativeView: public QDeclarativeView
@@ -183,20 +160,6 @@ public:
{
setResizeMode(QDeclarativeView::SizeRootObjectToView);
}
-
-protected:
- void paintEvent(QPaintEvent *event)
- {
- QDeclarativeView::paintEvent(event);
-
-#ifdef QML_RUNTIME_TESTING
- RenderStatistics::updateStats();
-#endif
-
- static bool continuousUpdate = qApp->arguments().contains("--continuous-update");
- if (continuousUpdate)
- scene()->update();
- }
};
#ifndef QT_NO_SCENEGRAPHITEM
@@ -499,7 +462,7 @@ int main(int argc, char ** argv)
displayFileDialog(&options);
#endif
- QWidget *view = 0;
+ QWindow *window = 0;
QDeclarativeEngine *engine = 0;
int exitCode = 0;
@@ -520,54 +483,37 @@ int main(int argc, char ** argv)
item->setSource(options.file);
} else
#endif
- if (!options.originalQml && !options.originalQmlRaster) {
- if (options.versionDetection)
- checkAndAdaptVersion(options.file);
- QSGView *qxView = new MyQSGView();
- qxView->setVSyncAnimations(options.vsync);
- engine = qxView->engine();
- for (int i = 0; i < imports.size(); ++i)
- engine->addImportPath(imports.at(i));
- view = qxView;
- if (options.file.isLocalFile()) {
- QFileInfo fi(options.file.toLocalFile());
- loadDummyDataFiles(*engine, fi.path());
- }
- qxView->setSource(options.file);
-
- } else {
- MyDeclarativeView *gvView = new MyDeclarativeView();
- engine = gvView->engine();
- for (int i = 0; i < imports.size(); ++i)
- engine->addImportPath(imports.at(i));
- view = gvView;
- if (options.file.isLocalFile()) {
- QFileInfo fi(options.file.toLocalFile());
- loadDummyDataFiles(*engine, fi.path());
- }
- gvView->setSource(options.file);
- if (!options.originalQmlRaster) {
- QGLWidget *viewport = new QGLWidget(getFormat());
- gvView->setViewport(viewport);
- }
+ if (options.versionDetection)
+ checkAndAdaptVersion(options.file);
+ QSGView *qxView = new MyQSGView();
+ qxView->setVSyncAnimations(options.vsync);
+ engine = qxView->engine();
+ for (int i = 0; i < imports.size(); ++i)
+ engine->addImportPath(imports.at(i));
+ window = qxView;
+ if (options.file.isLocalFile()) {
+ QFileInfo fi(options.file.toLocalFile());
+ loadDummyDataFiles(*engine, fi.path());
}
+ qxView->setSource(options.file);
QObject::connect(engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
if (options.fullscreen)
- view->showFullScreen();
+ window->showFullScreen();
else if (options.maximized)
- view->showMaximized();
+ window->showMaximized();
else
- view->show();
+ window->show();
+
#ifdef Q_WS_MAC
- view->raise();
+ window->raise();
#endif
exitCode = app.exec();
- delete view;
+ delete window;
#ifdef QML_RUNTIME_TESTING
RenderStatistics::printTotalStats();
diff --git a/tools/tools.pro b/tools/tools.pro
index dccdce8160..29340c61b0 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
SUBDIRS += qmlviewer qmlscene qmlplugindump
-contains(QT_CONFIG, qmltest): SUBDIRS += qmltestrunner
+
+# ### refactor: port properly
+# contains(QT_CONFIG, qmltest): SUBDIRS += qmltestrunner