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

QtCreator mutilates qobject.h on refactoring

XMLWordPrintable

    • Linux/Wayland
    • 81de42a1c (18.0)

      The refactoring function "Move Class to a Dedicated Set of Source Files" from right click context menu on class declaration may move the definition "class Q_CORE_EXPORT QObject {...}" from qobject.h in the tool chain to the newly created source file leaving behind an unusable tool chain.

      If  QtCreator has no write permission on qobject.h it will spawn a dialog window to ask for these permissions.

      Inheriting from a QObject derived class seems necessary. See the attached example with Readme

      If you run this on a toolchain where the user running QtCreator has no write permissions on the toolchain:
      * open QtCreatorProject/QtCreatorBugMinimalExample/QtCreatorBugMinimalExample.pro in QtCreator
      * open the file class.hpp
      * right click on the class name "classB" in the class declaration
        * select "refactor"
        * select "Move class to a dedicated set of source files"
        * confirm the **first** following dialog
        * you will now see a dialog prompting you to give write permissions on qobject.h - ABORT THIS!
        * now look at the newly created source file and find definitions for Qobject
      

      This has been encountered with with QtCreator 18.0.0 from from qt-online-installer and the accompanying tool chain.

      IMHO QtCreator should never write to headers in the tool chain. I even think write access outside project directory and build directory is suspicious. QtCreator already generates a notification if a header file from outside the project directory is opened in the editor (and rightfully so).

        1. example.tar-1.gz
          2 kB
          superflausch
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kandeler Christian Kandeler
            superflausch superflausch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes