Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-1198

Modifying a Q_OBJECT class erroneously modifies the vcxproj + filters files, removing <QtMoc> in favor of <ClInclude>, breaking file generation for that file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 3.2.0
    • General
    • None
    • Windows 10 Enterprise Version 10.0.19045 Build 19045
      Visual Studio 2019 & 2022
      Qt C++ 5.12.5
      Perforce Helix P4V source control
      Visual AssistX add-in
    • Windows

    Description

      With the 3.2.0 (rev 43) Qt VS addin recently deployed as an automatic Visual Studio extension update, our dev team has verified the following issue:

      Whenever a header file with a Q_OBJECT class is modified (something as simple as a newline), the VS add-in automatically modifies the associated project and filters files (vcxproj and vcxproj.filters). The modification replaces the correct <QtMoc> tags for that header file with incorrect <ClInclude> tags, which then breaks moc file generation for that file.

      It seems that Visual Studio's "Save All" feature is the 100% repro trigger for this behavior, sometimes simply saving the modified header isn't enough to observe it.

      Here's an example of the behavior: I have Foo.h, with

      class Foo : public QObject
      {
          Q_OBJECT
      //[...]
      };

      in the parent project file I'll see:

      <QtMoc Include="Folder\Foo.h" />

      now if I modify Foo.h with a newline and use "Save All", I can see in my source control software, the project file has also been checked out (along with the filters file), and that entry now reads:

      <ClInclude Include="Folder\Foo.h" />

      This is undesirable behavior that should be fixed ASAP. Right now the dev team has been instructed to stay on 3.0.2 and disable updates for that add-in.

      Our environment uses P4VS Helix Core server as our source control add-in, routing to our Perforce environment.

      Attachments

        1. Untitled.png
          Untitled.png
          44 kB
        2. ProjectProperties.jpg
          ProjectProperties.jpg
          166 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ali.demiralp Ali Can Demiralp
            loicbgs Loic Hamon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes