proper use of QFlags

René J.V. Bertin rjvbertin at gmail.com
Fri Apr 14 06:46:20 UTC 2017


Hi,

The QtCurve style fails to build against Qt 5.9.0: it triggers a compile-time assert in the QFlags class on the function below.

Am I right that the argument `QFlags<State> state` should simply be `State state`?

It seems logical given that the `State` type is already a `QFlags<something>` but I find it hard to wrap my head around what it really does (and even more what QFlags<State> would mean).
Modifying the code that way makes it build, and I haven't noticed any runtime differences but I'm not certain what the function is supposed to do and when.

Thanks,
René

    const QColor&
    MOArrow(QFlags<State> state, const QPalette &palette, bool mo,
            QPalette::ColorRole rol) const
    {
        if (!(state & State_Enabled)) {
            return palette.color(QPalette::Disabled, rol);
        } else if (opts.coloredMouseOver != MO_NONE && mo) {
            return m_mouseOverCols[ARROW_MO_SHADE];
        } else {
            return palette.color(rol);
        }
    }



More information about the Plasma-devel mailing list