Reputation: 1338
I wonder is there any difference between Qt::ShiftModifier
and Qt::Key_Shift
?
And what the difference between :
if(event->modifiers() & Qt::ShiftModifier){...}
and
if(event->modifiers() == Qt::ShiftModifier){...}
Upvotes: 3
Views: 769
Reputation: 22376
Qt::ShiftModifier
comes from the Qt::KeyboardModifier
enum with a value of 0x02.
Qt::Key_Shift
comes from the Qt::Key
enum with a value of 0x01000020.
They're 'meaning' is the same, but they are used in different contexts.
if(event->modifiers() & Qt::ShiftModifier){...}
Does the modifiers bitfield contain a shift? This is just a standard C/C++ bit operation.
if(event->modifiers() == Qt::ShiftModifier){...}
Does the modifier bitfield only contain a shift?
Upvotes: 4