From 081a2b9b1f633fc54f6288a0ea5974a545035327 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 4 Nov 2021 16:26:35 +0100 Subject: QMacStyle: skip 'custom' rendering of CE_HeaderLabel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead, similar to 'Fusion' style use what common style can do, thus respecting text alignment and not always forcing VCenter alignment. Fixes: QTBUG-97698 Change-Id: I89ad01807afc217c3c33650e1f1d255d0b81ed46 Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/plugins/styles') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 93d51171da..4515b2b0ed 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -3556,34 +3556,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter ir.right() - headerSectionSeparatorInset, ir.bottom())); } - break; - case CE_HeaderLabel: - if (const QStyleOptionHeader *header = qstyleoption_cast(opt)) { - p->save(); - QRect textr = header->rect; - if (!header->icon.isNull()) { - QIcon::Mode mode = QIcon::Disabled; - if (opt->state & State_Enabled) - mode = QIcon::Normal; - int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); - QPixmap pixmap = header->icon.pixmap(QSize(iconExtent, iconExtent), p->device()->devicePixelRatio(), mode); - - QRect pixr = header->rect; - QSizeF size = pixmap.deviceIndependentSize(); - pixr.setY(header->rect.center().y() - (size.height() - 1) / 2); - proxy()->drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap); - textr.translate(size.width() + 2, 0); - } - QString text = header->text; - if (const QStyleOptionHeaderV2 *headerV2 = qstyleoption_cast(header)) { - if (headerV2->textElideMode != Qt::ElideNone) - text = header->fontMetrics.elidedText(text, headerV2->textElideMode, textr.width()); - } - - proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette, - header->state.testFlag(State_Enabled), text, QPalette::ButtonText); - p->restore(); - } break; case CE_ToolButtonLabel: if (const QStyleOptionToolButton *tb = qstyleoption_cast(opt)) { -- cgit v1.2.3