Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Q_DECLARE_INCOMPATIBLE_FLAG - this seems like a useful macro, but I can't find any documentation on it.



  • Edit: It doesn't seem like this macro did what I hoped it would, under more inspection. Maybe there's a better way to set mutually exclusive options? </end edit>

    Supposing I have flags that are mutually exclusive (say something can either be A or B, which I'd like to be named flags), this seems useful.

    At the moment I'm doing something I think is a bit hacky

    Enum Flag{
      A = 1,
      B = ~1
    };
    Q_DECLARE_FLAGS(Flags, Flag)
    

    But the Incompatible flag option seems more like the right approach (given what I can kind of figure from the source code around the macro)


Log in to reply