diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-02-19 08:14:31 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-02-19 22:21:30 +0100 |
commit | 4c6579eacded086ad014b0fd2432095362c1d131 (patch) | |
tree | 8d05881925732345d309bc605c77dd5e7bf9dfc1 /src/widgets/styles/qfusionstyle.cpp | |
parent | 6172f3101e6606d48cca8424c5472af1daeefc17 (diff) |
Unbreak binary compatibility in QStyleOptionHeader
4d943846128118e1b9932a17ce6f977a0f4127a5 introduced a new data member to
QStyleOptionHeader, and reduced the size of the orientation member.
This changed the binary layout of class instances, and breaks ABI.
180c662b0790c6eceffdcb4661681d7df1541a2d added another member within
the new bitfield.
Introduce a new QStyleOptionHeaderV2 class instead with the new members,
and use that in QHeaderView, and the styles using the new members.
Fixes: QTBUG-91224
Pick-to: 6.1
Change-Id: I47e6841e6652e4b67f247b7b4514e90be5609156
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/widgets/styles/qfusionstyle.cpp')
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index d2eb5e25cc..5772c7d4c4 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1280,10 +1280,12 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->save(); // Draws the header in tables. if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { + const QStyleOptionHeaderV2 *headerV2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(option); QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size()); pixmapName += QString::number(- int(header->position)); pixmapName += QString::number(- int(header->orientation)); - pixmapName += QString::number(- int(header->isSectionDragTarget)); + if (headerV2) + pixmapName += QString::number(- int(headerV2->isSectionDragTarget)); QPixmap cache; if (!QPixmapCache::find(pixmapName, &cache)) { @@ -1294,7 +1296,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio QColor buttonColor = d->buttonColor(option->palette); QColor gradientStartColor = buttonColor.lighter(104); QColor gradientStopColor = buttonColor.darker(102); - if (header->isSectionDragTarget) { + if (headerV2 && headerV2->isSectionDragTarget) { gradientStopColor = gradientStartColor.darker(130); gradientStartColor = gradientStartColor.darker(130); } |