Differences between QQmlEngine window compiled and started from Qt Creator and from VS2010



  • Hi,
    There are a huge differences between view of QML window, which compiled and started from Qt Creator and from VS2010. I have the following code in main.cpp:

    QQmlEngine engine;
    QQmlComponent *component = new QQmlComponent(&engine);
    component->loadUrl(QUrl("../../dashboard/main.qml"));
    
    QObject *topLevel = component->create();
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    QSurfaceFormat surfaceFormat = window->requestedFormat();
    window->setFormat(surfaceFormat);
    window->show();
    

    And some QML file with ApplicationWindow and several simple components (layouts, rectangles, splitviews, etc).
    When I execute this from Qt Creator, I have a window with right view (all components, positions, anchors, sizes are as expected). SplitView working correctly (split moving, sizes of parts change).
    When I try to execute the same code from VS2010, I have absolutely wrong object positions. All of them groupped at the top of window, some of them are above other. The SplitView doesn't work correctly (it doesn't fill window, the partition is moved but sizes of parts are not changed). It's looked really weird.
    Is anyone faced with the same behavior? I've just tried many options and cannot find the reason.
    Thank you!



  • Probably you should implement what the QQuickView class does. It has resizeMode property that accepts QQuickView::SizeRootObjectToView value and does the right thing.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.