return of Qt::Checked/Unchecked is not bool

• Jun 9, 2017 - 10:53
Reported version
3.0
Type
Functional
Severity
S4 - Minor
Status
closed
Project

gcc7 is complaining about

mscore/osc.cpp:344:66: warning: ?: using integer constants in boolean context [-Wint-in-bool-context]
mixer->partEdit(i)->mute->setChecked(val==0.0f ? Qt::Unchecked : Qt::Checked);

and I think it is right in that Qt::Unchecked and Qt::Checked return and int, not a bool


Comments

It is an enum and can be 0 (Qt::Unchecked ) 1 (Qt::PartiallyChecked) and 2 (Qt::Checked), see http://doc.qt.io/qt-5/qt.html#CheckState-enum

It is used in a similar way as in osc.cpp in several other places throughout the code, only there it uses `setCheckState()`, so I think we should change that here too.

Except that a QToolButton doesn't have this :-(

So I guess we should make this
`mixer->partEdit(i)->mute->setChecked(val==0.0f ? false : true);`