Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26714

Qt Creator mixes up types from different modules even if some qualifiers are used

    XMLWordPrintable

Details

    • fd5bcea5f6 (qt-creator/qt-creator/8.0) fd5bcea5f6 (qt-creator/qt-creator/master) fd5bcea5f6 (qt-creator/tqtc-qt-creator/8.0)

    Description

      In a simple test project like this:

      import Qt.labs.platform 1.1 as QtLabs
      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")    
      
          Dialog {
              width: 340
              height: 340
          }
      }
      

      Qt Creator seems to assume the Dialog to be from the labs module even though the import has been given a qualifier which is not used with "Dialog". So technically the Dialog should be from QQC2 but Qt Creator disagrees. This results in Qt Creator giving warnings about "invalid property name" while in reality the code would run fine.

      Steps to reproduce the errors:

      • Open the attached project in Qt Creator
      • Open main.qml in editor

      The workaround:

      Add a qualifier for QQC2 as well. Example:

      import Qt.labs.platform 1.1 as QtLabs
      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15 as QQC2
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          QQC2.Dialog {
              width: 340
              height: 340
          }
      }
      

       In this case the errors disappear and autocompletion for code works well.

      Attachments

        1. warnings.png
          warnings.png
          122 kB
        2. qtcreatorbug26714.zip
          2 kB

        Activity

          People

            cstenger Christian Stenger
            miikapernu Miika Pernu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: