diff options
| author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2025-04-29 20:53:23 +0200 |
|---|---|---|
| committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2025-05-01 02:45:02 +0200 |
| commit | a1612886bade6192fecad33d0dacb1d24792e315 (patch) | |
| tree | 6121b26f9b9069a4522d6dc7c50bf313be765172 /src/widgets/kernel/qwidget.cpp | |
| parent | e19607611c996505c859b264122b8d44d8298b9c (diff) | |
Widgets/Stylesheets: Remove double negations for stylehseet feature
Replace ifndef QT_NO_STYLE_STYLESHEET antipattern by
if QT_CONFIG(style_stylesheet).
Pick-to: 6.9
Task-number: QTBUG-136341
Change-Id: I8f5d5ff0b7b5cce010df167977214bc92a9443b7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
| -rw-r--r-- | src/widgets/kernel/qwidget.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index eaf6d00942e..3d05dca4629 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1682,7 +1682,7 @@ void QWidgetPrivate::deleteExtra() { if (extra) { // if exists deleteSysExtra(); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) // dereference the stylesheet style if (QStyleSheetStyle *proxy = qt_styleSheet(extra->style)) proxy->deref(); @@ -2542,7 +2542,7 @@ void QWidget::setScreen(QScreen *screen) d->setScreen(screen); } -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) /*! \property QWidget::styleSheet @@ -2647,7 +2647,7 @@ void QWidget::setStyle(QStyle *style) Q_D(QWidget); setAttribute(Qt::WA_SetStyle, style != nullptr); d->createExtra(); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) if (QStyleSheetStyle *styleSheetStyle = qt_styleSheet(style)) { //if for some reason someone try to set a QStyleSheetStyle, ref it //(this may happen for example in QButtonDialogBox which propagates its style) @@ -2668,7 +2668,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate) createExtra(); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) QPointer<QStyle> origStyle = extra->style; #endif extra->style = newStyle; @@ -2689,7 +2689,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate) } } -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) if (!qt_styleSheet(newStyle)) { if (const QStyleSheetStyle* cssStyle = qt_styleSheet(origStyle)) { cssStyle->clearWidgetFont(q); @@ -2700,7 +2700,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate) QEvent e(QEvent::StyleChange); QCoreApplication::sendEvent(q, &e); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) // dereference the old stylesheet style if (QStyleSheetStyle *proxy = qt_styleSheet(origStyle)) proxy->deref(); @@ -2710,7 +2710,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate) // Inherits style from the current parent and propagates it as necessary void QWidgetPrivate::inheritStyle() { -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) Q_Q(QWidget); QStyle *extraStyle = extra ? (QStyle*)extra->style : nullptr; @@ -4688,7 +4688,7 @@ void QWidget::setFont(const QFont &font) { Q_D(QWidget); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) const QStyleSheetStyle* style; if (d->extra && (style = qt_styleSheet(d->extra->style))) style->saveWidgetFont(this, font); @@ -4797,7 +4797,7 @@ void QWidgetPrivate::resolveFont() void QWidgetPrivate::updateFont(const QFont &font) { Q_Q(QWidget); -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) const QStyleSheetStyle* cssStyle; cssStyle = extra ? qt_styleSheet(extra->style) : nullptr; const bool useStyleSheetPropagationInWidgetStyles = @@ -4827,7 +4827,7 @@ void QWidgetPrivate::updateFont(const QFont &font) QWidget *w = qobject_cast<QWidget*>(children.at(i)); if (w) { if (0) { -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) } else if (!useStyleSheetPropagationInWidgetStyles && w->testAttribute(Qt::WA_StyleSheet)) { // Style sheets follow a different font propagation scheme. if (cssStyle) @@ -4842,7 +4842,7 @@ void QWidgetPrivate::updateFont(const QFont &font) } } -#ifndef QT_NO_STYLE_STYLESHEET +#if QT_CONFIG(style_stylesheet) if (!useStyleSheetPropagationInWidgetStyles && cssStyle) { cssStyle->updateStyleSheetFont(q); } |
