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

QML "Refactoring" -> "Move Component to Separate file" shouldn't move local imports

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • Qt Creator 3.3.0-beta1
    • Quick / QML Support
    • None

      If I have files like this

      |   deployment.pri
      |   main.cpp
      |   main.qml
      |   qml.qrc
      |   withsubdirectoryimport.pro
      |
      \---testdir
              MyText.qml
      

      and I want to refactor something from the main.qml

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import "testdir"
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          menuBar: MenuBar {
              Menu {
                  title: qsTr("File")
                  MenuItem {
                      text: qsTr("Exit")
                      onTriggered: Qt.quit();
                  }
              }
          }
      
          MyText {
              anchors.centerIn: parent
              height: 100
              width: 100
          }
      }
      

      for example I am right clicking on Menu: "Refactoring" -> "Move Component to Separate file" I am getting this:

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import "testdir"
      
      Menu {
          title: qsTr("File")
          MenuItem {
              text: qsTr("Exit")
              onTriggered: Qt.quit();
          }
      }
      

      It would be very good if the local import 'import "testdir"' wouldn't be moved to the new component file.

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

            qtqmlteam Qt Qml Team User
            tjenssen Tim Jenssen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes