QQuickView problems



  • wrote a minimal qquick app and I'm getting an error in the debug stream

    "QQuickView does not support using windows as a root item.
    If you wish to create your root window from QML, consider using QQmlApplicationEngine instead."

    Also when I don't call qqv.show() the form displays anyway. If I do call show() a second empty window pops up.
    Code attached. Running on Windows 10 and developed using Visual Studio comunity 2015.

    #include <QtWidgets/QApplication>
    #include <QtQuick/QQuickView>

    int main(int argc, char * argv[])
    {

    QApplication app(argc, argv);
    QQuickView qqv;
    qqv.setResizeMode(QQuickView::SizeRootObjectToView);	
    qqv.setSource(QUrl("qrc:/main.qml"));
    // qqv.show();
        return app.exec();
    

    }

    Thanks
    O.



  • It is warning of a window object in main.qml and QQuickView are duplicated.
    You should be delete window QML object in main.qml.

    ex)

    import QtQuick 2.4
    import QtQuick.Window 2.2
    
    //Window {
    //    visible: true
    
        MainForm {
            anchors.fill: parent
            mouseArea.onClicked: {
                Qt.quit();
            }
        }
    //}
    


  • @Devopia53 Fixed! thanks.


Log in to reply
 

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