QFlags tutorial
Simple tutorial for safe-usage QFlags
Overview
First of all we should write about macro Q_FLAGS
This macro registers one or several flags types to the meta-object system
Example:
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags, which is of type QFlags<T>.
The Q_DECLARE_FLAGS() macro does not expose the flags to the meta-object system, so they cannot be used by Qt Script. To make the flags available for these purpose, the Q_FLAGS() macro must be used.
Usage sample
testFlag(flag) method checks if flag is set in QFlags.