src/basics.h

changeset 1291
9c570a30c98a
parent 1273
900f1dfae46b
child 1305
31627acdd4b5
--- 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);
+}

mercurial