Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-108650

Unclear error message: TextField cannot be resolved

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.x
    • 6.4.1, 6.5
    • QML: Compiler
    • All

    Description

      Since Qt 6.4.1 (6.4.0 works fine, 6.5.x behaves like 6.4.1) using a simple TextField produces a number of compiler warnings:

       

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
          title: "TextField n/a"
      
          TextField {
              anchors.centerIn: parent
          }
      }
      
      Warning: main.qml:2:1: Warnings occurred while importing module "QtQuick.Controls":
      import QtQuick.Controls
      ^^^^^^
      ---
      Warning: QtQuick.Controls uses optional imports which are not supported. Some types might not be found.
      ---
      
      Warning: main.qml:10:5: TextField was not found. Did you add all import paths?
          TextField {
          ^^^^^^^^^
      Warning: main.qml:11:9: unknown grouped property scope anchors.
              anchors.centerIn: parent
              ^^^^^^^
      Warning: main.qml:10:5: 'TextField' is used but it is not resolved
          TextField {
          ^^^^^^^^^
      Warning: main.qml:11:9: 'anchors' is used but it is not resolved
              anchors.centerIn: parent
              ^^^^^^^
      Warning: main.qml:10:5: Type TextField is used but it is not resolved
          TextField {
          ^^^^^^^^^
      Warning: main.qml:11:17: Binding assigned to "centerIn", but no property "centerIn" exists in the current element.
              anchors.centerIn: parent
                      ^^^^^^^^
      Info: main.qml:2:1: Unused import at main.qml:2:1
      import QtQuick.Controls
      ^^^^^^
      Error: main.qml:11:17: Could not compile binding for centerIn: Cannot resolve property type  for binding on centerIn
      import QtQuick
      ^
      

      QuickControls have been added to CMakeLists.txt (see attached example). Apart from this output, the app works fine.

      Funny that it complains about the unused Controls import...

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              moerkb Markus Bader
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes