aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qmlscene/main.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 0d97ba190b..9ed0256ffd 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -137,15 +137,6 @@ void RenderStatistics::printTotalStats()
}
#endif
-class MyQQuickView : public QQuickView
-{
-public:
- MyQQuickView() : QQuickView()
- {
- setResizeMode(QQuickView::SizeRootObjectToView);
- }
-};
-
struct Options
{
Options()
@@ -157,6 +148,7 @@ struct Options
, versionDetection(true)
, slowAnimations(false)
, quitImmediately(false)
+ , resizeViewToRootItem(false)
{
}
@@ -170,6 +162,7 @@ struct Options
bool versionDetection;
bool slowAnimations;
bool quitImmediately;
+ bool resizeViewToRootItem;
};
#if defined(QMLSCENE_BUNDLE)
@@ -349,6 +342,7 @@ static void usage()
qWarning(" --no-multisample .......................... Disable multisampling (anti-aliasing)");
qWarning(" --no-version-detection .................... Do not try to detect the version of the .qml file");
qWarning(" --slow-animations ......................... Run all animations in slow motion");
+ qWarning(" --resize-to-root .......................... Resize the window to the size of the root item");
qWarning(" --quit .................................... Quit immediately after starting");
qWarning(" -I <path> ................................. Add <path> to the list of import paths");
qWarning(" -B <name> <file> .......................... Add a named bundle");
@@ -380,6 +374,8 @@ int main(int argc, char ** argv)
options.slowAnimations = true;
else if (lowerArgument == QLatin1String("--quit"))
options.quitImmediately = true;
+ else if (lowerArgument == QLatin1String("--resize-to-root"))
+ options.resizeViewToRootItem = true;
else if (lowerArgument == QLatin1String("-i") && i + 1 < argc)
imports.append(QString::fromLatin1(argv[++i]));
else if (lowerArgument == QLatin1String("-b") && i + 2 < argc) {
@@ -419,7 +415,7 @@ int main(int argc, char ** argv)
if (!options.file.isEmpty()) {
if (!options.versionDetection || checkVersion(options.file)) {
- QQuickView *qxView = new MyQQuickView();
+ QQuickView *qxView = new QQuickView();
engine = qxView->engine();
for (int i = 0; i < imports.size(); ++i)
engine->addImportPath(imports.at(i));
@@ -434,6 +430,11 @@ int main(int argc, char ** argv)
QObject::connect(engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
+ if (options.resizeViewToRootItem)
+ qxView->setResizeMode(QQuickView::SizeViewToRootObject);
+ else
+ qxView->setResizeMode(QQuickView::SizeRootObjectToView);
+
window->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
if (options.fullscreen)
window->showFullScreen();