From af5d0b0f0cf7bea08cb48a31404c9775115ab09a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 20 Oct 2023 09:29:58 +0200 Subject: [PATCH] QStyleSheetStyle: use pmf-style connect Use pmf-style connect in QStyleSheetStyle. styles subdir is now old-style connection free. Change-Id: I926ff308a823212b0512328b96dd6779d6cb30fa Reviewed-by: Qt CI Bot Reviewed-by: Axel Spoerl --- src/widgets/styles/qstylesheetstyle.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 1b7db3b5b1..8bba6280b3 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -1681,7 +1681,8 @@ QList QStyleSheetStyle::styleRules(const QObject *obj) const defaultSs = getDefaultStyleSheet(); QStyle *bs = baseStyle(); styleSheetCaches->styleSheetCache.insert(bs, defaultSs); - QObject::connect(bs, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); + QObject::connect(bs, &QStyle::destroyed, styleSheetCaches, + &QStyleSheetStyleCaches::styleDestroyed); } else { defaultSs = defaultCacheIt.value(); } @@ -2904,7 +2905,9 @@ bool QStyleSheetStyle::initObject(const QObject *obj) const const_cast(w)->setAttribute(Qt::WA_StyleSheet, true); } - QObject::connect(obj, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(objectDestroyed(QObject*)), Qt::UniqueConnection); + connect(obj, &QObject::destroyed, + styleSheetCaches, &QStyleSheetStyleCaches::objectDestroyed, + Qt::UniqueConnection); return true; } @@ -2948,10 +2951,10 @@ void QStyleSheetStyle::polish(QWidget *w) QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled); if ((rule.hasBorder() && rule.border()->hasBorderImage()) || (rule.hasBackground() && !rule.background()->pixmap.isNull())) { - QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), - sa, SLOT(update()), Qt::UniqueConnection); - QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)), - sa, SLOT(update()), Qt::UniqueConnection); + connect(sa->horizontalScrollBar(), &QScrollBar::valueChanged, + sa, QOverload<>::of(&QAbstractScrollArea::update), Qt::UniqueConnection); + connect(sa->verticalScrollBar(), &QScrollBar::valueChanged, + sa, QOverload<>::of(&QAbstractScrollArea::update), Qt::UniqueConnection); } } #endif @@ -3054,13 +3057,13 @@ void QStyleSheetStyle::unpolish(QWidget *w) setGeometry(w); w->setAttribute(Qt::WA_StyleSheetTarget, false); w->setAttribute(Qt::WA_StyleSheet, false); - QObject::disconnect(w, nullptr, this, nullptr); + w->disconnect(this); #if QT_CONFIG(scrollarea) if (QAbstractScrollArea *sa = qobject_cast(w)) { - QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), - sa, SLOT(update())); - QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)), - sa, SLOT(update())); + disconnect(sa->horizontalScrollBar(), &QScrollBar::valueChanged, + sa, QOverload<>::of(&QAbstractScrollArea::update)); + disconnect(sa->verticalScrollBar(), &QScrollBar::valueChanged, + sa, QOverload<>::of(&QAbstractScrollArea::update)); } #endif baseStyle()->unpolish(w);