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

Refactoring QML element into component takes the wrong id as the filename

    XMLWordPrintable

Details

    Description

      Have the code below and try to refactor the first Rectangle element into a component.
      Result: The filename wrongly becomes ParentItem.qml. QuickFix operation should not be permitted here due to missing id.

      Suggestion: Have the quickfix operation search all the items in children of Rectangle {} and pick the first one with an id property. Also, check for objectName properties and use the first one found as a filename if no id's are available.

      import Qt 4.7
      Item {
          Item {
              id: parentItem
      
              Rectangle {
                  width: parent.width
                  height: 74
                  TextInput {
                      id: filterText
                      anchors.left: parent.left
                      anchors.right: parent.right
                      anchors.verticalCenter: parent.verticalCenter
                      onTextChanged: {
                          contactsModel.filterText = filterText.text
                      }
                      font.pixelSize: 25
                  }
                  Image {
                      id: clearFilterButton
                      anchors.verticalCenter: parent.verticalCenter
                      anchors.right: parent.right
                      anchors.rightMargin: 0
                      source: "images/button.png"
                      width: 40
      
                      Text{
                          font.pixelSize: 25
                          color: "#d8d8d8"
                          text: "X"
                          anchors.centerIn: parent
                      }
      
                      MouseArea {
                          anchors.fill: parent
                          onClicked: {
                              filterText.text = ""
                          }
                      }
                  }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            erikv Erik Verbruggen
            holmsted Lasse Holmstedt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes