From ed49a84e6caa8c76f2edd382a4405028d07a9fba Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 27 Mar 2019 18:45:10 +0100 Subject: QListWidget: don't hide setBackgroundColor with QT_DISABLE_DEPRECATED_SINCE QListWidget::setBackgroundColor() is a virtual function. Hiding this function when compiling/linking against QtWidgets when QT_DISABLE_DEPRECATED_SINCE is set will therefore screw up the vtable and it will crash on runtime. Therefore don't surround them with QT_DEPRECATED_SINCE macro. Fixes: QTBUG-74665 Change-Id: Icb0f253117a1e55a338d2d6969ec2d59fbd0679d Reviewed-by: Giuseppe D'Angelo Reviewed-by: David Faure --- src/widgets/itemviews/qlistwidget.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index c093d13e6d..c102b144df 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -118,10 +118,11 @@ public: QT_DEPRECATED_X ("Use QListWidgetItem::background() instead") inline QColor backgroundColor() const { return qvariant_cast(data(Qt::BackgroundRole)); } +#endif + // no QT_DEPRECATED_SINCE because it is a virtual function QT_DEPRECATED_X ("Use QListWidgetItem::setBackground() instead") virtual void setBackgroundColor(const QColor &color) { setData(Qt::BackgroundRole, color); } -#endif inline QBrush background() const { return qvariant_cast(data(Qt::BackgroundRole)); } -- cgit v1.2.3 From 409e3eab092ae9896f453b69f4b4749e654680bb Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 28 Mar 2019 10:42:38 +0100 Subject: QMacStyle - fix PE_InticatorTabClose handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for the case a custom style sheet is in use and QStyleSheetStyle replaces the widget (close button) with its parent (QTabBar). We still need this button though to compare against tabButton on a hovered tab. This allows us to have, indeed, native-looking tabs as documented (aka similar to Safari or the "Terminal" application). Change-Id: I53ff78699e705db6d7c7b84774b8e188a1277535 Fixes: QTBUG-61092 Fixes: QTBUG-74689 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qstylesheetstyle.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 79fa20851f..73b147e622 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4590,8 +4590,12 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op break; #if QT_CONFIG(tabbar) case PE_IndicatorTabClose: - if (w) + if (w) { + // QMacStyle needs a real widget, not its parent - to implement + // 'document mode' properly, drawing nothing if a tab is not hovered. + baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant::fromValue((void *)w)); w = w->parentWidget(); //match on the QTabBar instead of the CloseButton + } pseudoElement = PseudoElement_TabBarTabCloseButton; #endif @@ -4609,6 +4613,9 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op } else { baseStyle()->drawPrimitive(pe, opt, p, w); } + + if (baseStyle()->property("_q_styleSheetRealCloseButton").toBool()) + baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant(QVariant::Invalid)); } QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap, -- cgit v1.2.3