April 2018
Beginner
714 pages
18h 21m
English
The state variable is a bitmask holding the possible states of the item. You can check its value against the values of the QStyle::StateFlag parameter using bitwise operators. In the preceding case, the state variable is checked against the State_Selected parameter. If this flag is set, we use green color for the pen.
Used with the preceding example, it would be as follows:
if (option->state.testFlag(QStyle::State_Selected)) {
The most important states you can use with items are described in the following table:
| State | Description |
|
State_Enabled |
Indicates ... |
Read now
Unlock full access