Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
6.0.0, 5.15
-
None
Description
Combining values from unrelated enumeration types raises static analyzer warnings, e.g. for code
QPainter p(this);
p.drawText(textRect, Qt::TextWordWrap|Qt::AlignVCenter, text);
Qt::TextWordWrap is a Qt::TextFlag, while Qt::AlignVCenter is a Qt::AlignmentFlag value. QPainter::drawText takes an int for the flags. QPen enums have related problems (Qt::PenStyle, Qt::PenCapStyle, and Qt::PenJoinStyle are designed so that they can be merged).
While explicitly casting the values to (u)int pacifies the analyzer, we should perhaps implement operators that allow combining values from those particular enums type-safely.