Function to handle logical combination of enums
-
Hi,
I have a class that has enums as
@enum SomeVariable
{
A = 1,
B= 2,
c= 3
};
Q_ENUMS(SomeVariable)@I need a function that would accept logical combination of these enums
like
@setVariable( A | B);
setVariable(B | C);
setVariable(A);
setVariable(B);
setVariable(C);@How can I handle this ? For different combination I will set a different setting in my application.
PS: Basic question :)
-
Hi,
QFlags is designed for your use-case; http://qt-project.org/doc/qt-5/QFlags.html
-
Also,
there is a tutorial "in the wiki":http://qt-project.org/wiki/QFlags_tutorial