Important: Please read the Qt Code of Conduct -

QT Creator 4, Is it possible to switch off deprecation warnings in system headers?

  • QT Creator 4 doesn't seem to like Q_DECLARE_OPERATORS_FOR_FLAGS very much.

    I have a class that declares some flags, like this

    class Executable
      enum Flag {
        CustomExecutable = 1 << 0,
        ShowInToolbar = 1 << 1,
        UseApplicationIcon = 1 << 2,
        CanLaunchGame = 1 << 3,
        AllFlags = 0xff //I know, I know
      Q_DECLARE_FLAGS(Flags, Flag)

    QT creator highlights the Q_DECLARE_OPERATORS_FOR_FLAGS line with a yellow triangle on the left, a lightbulb on the right and a very thin almost invisible reddish line beneath.

    If I click on the lightbulb, if I am lucky, it tells me to use noexcept instead. Otherwise it does nothing.

    If a hold the mouse over the triangle, nothing happens. If I hold the mouse over the Q_DECLARE_OPERATORS_FOR_FLAGS, after a pause, creator comes up with a box containing multiple messages about deprecation warnings (with -Wdeprecated). I'd copy them here, but the box is non copyable.

    Where does the -Wdeprecated come from? I see that QtCretor is running a clang child processs which may be related but I don't remember asking it to do that for me, and telling me something in a system header file is deprecated isn't helpful because there's not a fat lot I can do about it.

    Is there anything I can do to switch this off? (I'm using QT5.5 at the moment)

Log in to reply