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

QtCreator flags deprecated calls even when it shouldn't

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 4.11.2
    • None
    • macOS

      I'm working on a project in Qt Creator 4.11.2, Qt 5.14.2.  I want this project to build against Qt 5.9.0 and later, so I can't use some of the latest APIs, and I don't want to be warned about some of the latest deprecations.  To that end, I have put this in my .pro file:

       

      # DEFINES += QT_DEPRECATED_WARNINGS
      DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050900
      

       

      So the QT_DEPRECATED_WARNINGS flag that is there by default is commented out, and I'm requesting errors only for APIs deprecated before 5.9.0.  That didn't seem to suffice, so after a bit of Googling I also added:

      QMAKE_CXXFLAGS += -Wno-deprecated-declarations
      

      With that, deprecated API warnings mostly seem to get suppressed – but not entirely, in Qt Creator, weirdly.  For example, I have a file that calls QTextEdit::setTabStopWidth(), which was deprecated in Qt 5.10; if I command-click on the call to see the header, it says:

      #if QT_DEPRECATED_SINCE(5, 10)
          QT_DEPRECATED int tabStopWidth() const;
          QT_DEPRECATED void setTabStopWidth(int width);
      #endif
      

      So that should be OK, and should not give a warning, right?  Since it was only deprecated in 5.10?  Well, if I touch the file and rebuild, in the Compile Output tab it indeed shows no warning, and in the Issues tab, too, no warning is reported.  But in the actual text of the file, Qt Creator still shows the warning, with the yellow warning icon and the annotation "'setTabStopWidth' is deprecated".  It doesn't seem to know that I have changed my deprecation settings, and it seems to scan for deprecated APIs using some method other than the actual build results.  I've tried quitting and relaunching Qt Creator, and I've tried completely deleting the build directory; I can't make the warning go away.  There are a bunch of other such warnings in my app's code that also won't go away, so it's kind of annoying.

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

            kandeler Christian Kandeler
            bhaller Ben Haller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes