--- a/src/basics.h Fri Mar 16 12:20:16 2018 +0200 +++ b/src/basics.h Fri Mar 16 16:28:39 2018 +0200 @@ -391,3 +391,15 @@ { return min(a, min(rest...)); } + +/* + * Assigns the value of a single flag in a flagset + */ +template<int Flag, typename T> +void assignFlag(QFlags<T>& flagset, bool value) +{ + if (value) + flagset |= static_cast<T>(Flag); + else + flagset &= ~static_cast<T>(Flag); +}