QCommonStyle: work around apparent MSVC bug in using QFlag
With the upcoming change to QFlags to support 64-bit, MSVC started to complain that it can't convert from Qt::Alignment to QFlag and back to Qt::Alignment. It is correct that this path has an explicit and shouldn't be taken, but a) it's worked for years b) GCC and Clang insert an extra conversion to int (I guess) In any case, header->iconAlignment is already a Qt::Alignment so we don't need to go through QFlag here. qcommonstyle.cpp(1666): error C2440: '<function-style-cast>': cannot convert from 'const Qt::Alignment' to 'QFlag' qcommonstyle.cpp(1666): note: Constructor for class 'QFlag' is declared 'explicit' Pick-to: 6.8 Change-Id: If349995b779be9e3dab4fffd8701af8615ae407b Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
939f7f5622
commit
dc1f4b742e
@ -1663,7 +1663,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
= header->icon.pixmap(QSize(iconExtent, iconExtent), QStyleHelper::getDpr(p), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
|
||||
int pixw = pixmap.width() / pixmap.devicePixelRatio();
|
||||
|
||||
QRect aligned = alignedRect(header->direction, QFlag(header->iconAlignment), pixmap.size() / pixmap.devicePixelRatio(), rect);
|
||||
QRect aligned = alignedRect(header->direction, header->iconAlignment, pixmap.size() / pixmap.devicePixelRatio(), rect);
|
||||
QRect inter = aligned.intersected(rect);
|
||||
p->drawPixmap(inter.x(), inter.y(), pixmap,
|
||||
inter.x() - aligned.x(), inter.y() - aligned.y(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user