From 4c6579eacded086ad014b0fd2432095362c1d131 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 19 Feb 2021 08:14:31 +0100 Subject: 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 --- src/widgets/styles/qcommonstyle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/styles/qcommonstyle.cpp') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index ff115596bf..a2f52562c8 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1682,11 +1682,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->setFont(fnt); fm = QFontMetrics((p->font())); } - QString text; - if (header->textElideMode != Qt::ElideNone) - text = fm.elidedText(header->text, header->textElideMode, rect.width()); - else - text = header->text; + QString text = header->text; + if (const QStyleOptionHeaderV2 *headerV2 = qstyleoption_cast(header)) { + if (headerV2->textElideMode != Qt::ElideNone) + text = fm.elidedText(header->text, headerV2->textElideMode, rect.width()); + } proxy()->drawItemText(p, rect, header->textAlignment, header->palette, header->state.testFlag(State_Enabled), text, QPalette::ButtonText); } -- cgit v1.2.3