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

Provide a visual indication when QML code contains "automatically-wrapped" Components

    XMLWordPrintable

Details

    Description

      Code

      import QtQuick
      import QtQuick.Controls.Basic
      
      Window {
          id: root
          width: 800
          height: 600
          visible: true
      
          Page {
              header: Rectangle {
                  width: root.width // OK
              }
          }
          ListView {
              header: Rectangle {
                  width: root.width // Unqualified access
              }
          }
      
          Popup {
              Rectangle {
                  width: root.width // OK
              }
          }
          Repeater {
              Rectangle {
                  width: root.width // Unqualified access
              }
          }
      }
      
      
      

       

      Issue
      Unless someone already has in-depth knowledge of the Qt Quick API, it is not obvious from the code why the Page and Popup are OK while the ListView and Repeater are not. (Answer: The type of Page.header is Item while the type of ListView.header is Component, so the code above is not assigning an instance of a Rectangle to ListView.header. Similar for Popup vs. Repeater)

       

      Suggestion
      Let the syntax highlighter or code editor provide a way to visually distinguish the two cases above at a glance

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes