}
#endif
-class MyQQuickView : public QQuickView
-{
-public:
- MyQQuickView() : QQuickView()
- {
- setResizeMode(QQuickView::SizeRootObjectToView);
- }
-};
-
struct Options
{
Options()
, versionDetection(true)
, slowAnimations(false)
, quitImmediately(false)
+ , resizeViewToRootItem(false)
{
}
bool versionDetection;
bool slowAnimations;
bool quitImmediately;
+ bool resizeViewToRootItem;
};
#if defined(QMLSCENE_BUNDLE)
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");
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) {
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));
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();