Qt World Summit: Register Today!

Cannot open this QML document because of an error in the QML file:

  • I have a .qml file containing multiple Qtquick controls 2.0 that I have been editing using both the Edit Tab and the Design Tab. It was originally refactored from a ui.qml file. Recently, whenever I click the design tab the following message appears:

    Cannot open this QML document because of an error in the QML file:
    Internal error (file: C:\work\build\qt-creator\src\plugins\qmldesigner\designercore\variantproperty.cpp, function: QMLDesigner::VariantProperty::setValue, line 62)

    I haven't opened the variantproperty.cpp file manually and don't understand why I am getting this error. I have reverted my QML file several times and after a number of uses this error reappears.

    I'm new to Qt so any help would be great. Does anyone know how to fix this?

  • Qt Champions 2017

    Hi Are you using the new Qt version to open the qml file. I suspect that you have created the .qml in earlier version & now you are opening the file with new qt installation.

  • Hi dheerendra,

    I created this project as a "Qt Quick Controls 2 Application" for Qt 5.7. I have these import statements in the QML files

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3

    My project contains a mix of qml and ui.qml files, but the file loading the C++ object is just qml.

    Was the syntax for importing objects changed in Qt 5.7?

  • The QML Designer does not allow imperative code. It is not possible to design files that execute arbitrary JS code. Did you not see any warnings that you should not edit .ui.qml files by hand? Use the pattern used in the application template: refer to the building blocks from the outside, where an instance if the UI form is created.

  • I got same issue.
    Solved removing Window flags "SplashScreen".

  • What caused the issue for me was an empty onClicked handler like so:
    Item {
    id: testDialog;

    Rectangle {
        id: dlgBackground
        MouseArea {
            anchors.fill: parent
            onClicked: ; //Deleting this line fixed the issue for me

    After removing the onClicked line the error did not occur anymore (you may need to close and reopen the qml file for the designer to pick up the changes).


Log in to reply