Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Cannot open this QML document because of an error in the QML file:
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlquick controls
7 Posts 6 Posters 7.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Julia Johnson
    wrote on 12 Jul 2016, 21:58 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 14 Jul 2016, 09:00 last edited by
      #2

      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.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      P 1 Reply Last reply 6 Feb 2023, 02:57
      4
      • J Offline
        J Offline
        Julia Johnson
        wrote on 14 Jul 2016, 14:39 last edited by
        #3

        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?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jpnurmi
          wrote on 14 Jul 2016, 15:10 last edited by
          #4

          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.

          1 Reply Last reply
          1
          • D Offline
            D Offline
            DarkWan
            wrote on 3 Aug 2016, 15:35 last edited by
            #5

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

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Sytse Reitsma
              wrote on 7 Nov 2016, 07:25 last edited by
              #6

              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).

              Sytse

              1 Reply Last reply
              0
              • D dheerendra
                14 Jul 2016, 09:00

                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.

                P Offline
                P Offline
                Patrick1983
                wrote on 6 Feb 2023, 02:57 last edited by
                #7

                @dheerendra I just installed Qt Creator, Designer, and Design Studio and am starting a project in Design Studio because I want to design a user interface that generates code but when I try to create a project Design Studio gives me the error "Cannot open this QML document because of an error in the QML file:" (like someone else posted in this forum). My problem seems to be that when I start a project in Qt Creator or Qt Design Studio I get another (probably related) error saying "The Design mode requires a valid Qt kit." and the kits in my "Create Project" settings are all faded.
                Any suggestions on this topic?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved