diff options
25 files changed, 138 insertions, 136 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d6926e7515..648b128ffd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3368,10 +3368,10 @@ bool QGuiApplicationPrivate::setPalette(const QPalette &palette) // Resolve the palette against the theme palette, filling in // any missing roles, while keeping the original resolve mask. QPalette basePalette = qGuiApp ? qGuiApp->d_func()->basePalette() : Qt::gray; - basePalette.resolve(0); // The base palette only contributes missing colors roles + basePalette.setResolveMask(0); // The base palette only contributes missing colors roles QPalette resolvedPalette = palette.resolve(basePalette); - if (app_pal && resolvedPalette == *app_pal && resolvedPalette.resolve() == app_pal->resolve()) + if (app_pal && resolvedPalette == *app_pal && resolvedPalette.resolveMask() == app_pal->resolveMask()) return false; if (!app_pal) @@ -3379,7 +3379,7 @@ bool QGuiApplicationPrivate::setPalette(const QPalette &palette) else *app_pal = resolvedPalette; - QCoreApplication::setAttribute(Qt::AA_SetPalette, app_pal->resolve() != 0); + QCoreApplication::setAttribute(Qt::AA_SetPalette, app_pal->resolveMask() != 0); return true; } diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 4129e189f3..5bcd4c8b10 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -961,20 +961,22 @@ QPalette QPalette::resolve(const QPalette &other) const } /*! - \fn uint QPalette::resolve() const + \fn QPalette::ResolveMask QPalette::resolveMask() const \internal */ /*! - \typedef ResolveMaskType + \typedef ResolveMask \internal - */ +*/ /*! - \fn void QPalette::resolve(ResolveMaskType mask) + \fn void QPalette::setResolveMask(ResolveMask) \internal -*/ + A bit mask that stores which colors the palette instance explicitly defines, + and which ones are inherited from a parent. +*/ /***************************************************************************** QPalette stream functions @@ -1250,7 +1252,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p) QDebugStateSaver saver(dbg); dbg.nospace(); - dbg << "QPalette(resolve=" << Qt::hex << Qt::showbase << p.resolve(); + dbg << "QPalette(resolve=" << Qt::hex << Qt::showbase << p.resolveMask(); auto roleString = rolesToString(p); if (!roleString.isEmpty()) diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index 1f0f6725d8..3e2786898f 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -157,8 +157,8 @@ public: QPalette resolve(const QPalette &other) const; using ResolveMask = quint64; - inline ResolveMask resolve() const { return data.resolveMask; } - inline void resolve(ResolveMask mask) { data.resolveMask = mask; } + inline ResolveMask resolveMask() const { return data.resolveMask; } + inline void setResolveMask(ResolveMask mask) { data.resolveMask = mask; } private: void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button, diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index b4e33b4270..a618179f98 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1761,12 +1761,12 @@ QFont QFont::resolve(const QFont &other) const } /*! - \fn uint QFont::resolve() const + \fn uint QFont::resolveMask() const \internal */ /*! - \fn void QFont::resolve(uint mask) + \fn void QFont::setResolveMask(uint mask) \internal */ diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 08f8f57810..b520421e89 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -275,8 +275,8 @@ public: QString defaultFamily() const; QFont resolve(const QFont &) const; - inline uint resolve() const { return resolve_mask; } - inline void resolve(uint mask) { resolve_mask = mask; } + inline uint resolveMask() const { return resolve_mask; } + inline void setResolveMask(uint mask) { resolve_mask = mask; } private: explicit QFont(QFontPrivate *); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index aead7d60e3..14b564fc73 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -324,7 +324,7 @@ size_t QTextFormatPrivate::recalcHash() const void QTextFormatPrivate::resolveFont(const QFont &defaultFont) { recalcFont(); - const uint oldMask = fnt.resolve(); + const uint oldMask = fnt.resolveMask(); fnt = fnt.resolve(defaultFont); if (hasProperty(QTextFormat::FontSizeAdjustment)) { @@ -342,7 +342,7 @@ void QTextFormatPrivate::resolveFont(const QFont &defaultFont) } } - fnt.resolve(oldMask); + fnt.setResolveMask(oldMask); } void QTextFormatPrivate::recalcFont() const @@ -1971,7 +1971,7 @@ QStringList QTextCharFormat::anchorNames() const void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior) { const uint mask = behavior == FontPropertiesAll ? uint(QFont::AllPropertiesResolved) - : font.resolve(); + : font.resolveMask(); if (mask & QFont::FamilyResolved) setFontFamily(font.family()); diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 8937765f6b..4c7064a845 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -93,7 +93,7 @@ void QCocoaMenu::setMinimumWidth(int width) void QCocoaMenu::setFont(const QFont &font) { - if (font.resolve()) { + if (font.resolveMask()) { NSFont *customMenuFont = [NSFont fontWithName:font.family().toNSString() size:font.pointSize()]; m_nativeMenu.font = customMenuFont; diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 601f715245..d8da357d6f 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -370,14 +370,14 @@ bool QWindowsXPStylePrivate::isItemViewDelegateLineEdit(const QWidget *widget) // Returns whether base color is set for this widget bool QWindowsXPStylePrivate::isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget) { - uint resolveMask = option->palette.resolve(); + uint resolveMask = option->palette.resolveMask(); if (widget) { // Since spin box includes a line edit we need to resolve the palette mask also from // the parent, as while the color is always correct on the palette supplied by panel, // the mask can still be empty. If either mask specifies custom base color, use that. #if QT_CONFIG(spinbox) if (const QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget())) - resolveMask |= spinbox->palette().resolve(); + resolveMask |= spinbox->palette().resolveMask(); #endif // QT_CONFIG(spinbox) } return (resolveMask & (1 << QPalette::Base)) != 0; diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index d2ae77fd83..c79c1e24c1 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -843,7 +843,7 @@ bool QGraphicsProxyWidget::event(QEvent *event) case QEvent::FontChange: { // Propagate to widget. QWidgetPrivate *wd = d->widget->d_func(); - int mask = d->font.resolve() | d->inheritedFontResolveMask; + int mask = d->font.resolveMask() | d->inheritedFontResolveMask; wd->inheritedFontResolveMask = mask; wd->resolveFont(); break; @@ -851,7 +851,7 @@ bool QGraphicsProxyWidget::event(QEvent *event) case QEvent::PaletteChange: { // Propagate to widget. QWidgetPrivate *wd = d->widget->d_func(); - int mask = d->palette.resolve() | d->inheritedPaletteResolveMask; + int mask = d->palette.resolveMask() | d->inheritedPaletteResolveMask; wd->inheritedPaletteResolveMask = mask; wd->resolvePalette(); break; diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 1e47885bc7..545b7c6c9b 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -1532,7 +1532,7 @@ void QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes() */ void QGraphicsScenePrivate::setFont_helper(const QFont &font) { - if (this->font == font && this->font.resolve() == font.resolve()) + if (this->font == font && this->font.resolveMask() == font.resolveMask()) return; updateFont(font); } @@ -1546,7 +1546,7 @@ void QGraphicsScenePrivate::setFont_helper(const QFont &font) void QGraphicsScenePrivate::resolveFont() { QFont naturalFont = QApplication::font(); - naturalFont.resolve(0); + naturalFont.setResolveMask(0); QFont resolvedFont = font.resolve(naturalFont); updateFont(resolvedFont); } @@ -1572,7 +1572,7 @@ void QGraphicsScenePrivate::updateFont(const QFont &font) // Resolvefont for an item is a noop operation, but // every item can be a widget, or can have a widget // childre. - item->d_ptr->resolveFont(font.resolve()); + item->d_ptr->resolveFont(font.resolveMask()); } } @@ -1589,7 +1589,7 @@ void QGraphicsScenePrivate::updateFont(const QFont &font) */ void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette) { - if (this->palette == palette && this->palette.resolve() == palette.resolve()) + if (this->palette == palette && this->palette.resolveMask() == palette.resolveMask()) return; updatePalette(palette); } @@ -1603,7 +1603,7 @@ void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette) void QGraphicsScenePrivate::resolvePalette() { QPalette naturalPalette = QGuiApplication::palette(); - naturalPalette.resolve(0); + naturalPalette.setResolveMask(0); QPalette resolvedPalette = palette.resolve(naturalPalette); updatePalette(resolvedPalette); } @@ -1629,7 +1629,7 @@ void QGraphicsScenePrivate::updatePalette(const QPalette &palette) // ResolvePalette for an item is a noop operation, but // every item can be a widget, or can have a widget // children. - item->d_ptr->resolvePalette(palette.resolve()); + item->d_ptr->resolvePalette(palette.resolveMask()); } } @@ -2548,8 +2548,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item) addItem(child); // Resolve font and palette. - item->d_ptr->resolveFont(d->font.resolve()); - item->d_ptr->resolvePalette(d->palette.resolve()); + item->d_ptr->resolveFont(d->font.resolveMask()); + item->d_ptr->resolvePalette(d->palette.resolveMask()); // Reenable selectionChanged() for individual items @@ -5562,7 +5562,7 @@ void QGraphicsScene::setFont(const QFont &font) { Q_D(QGraphicsScene); QFont naturalFont = QApplication::font(); - naturalFont.resolve(0); + naturalFont.setResolveMask(0); QFont resolvedFont = font.resolve(naturalFont); d->setFont_helper(resolvedFont); } @@ -5599,7 +5599,7 @@ void QGraphicsScene::setPalette(const QPalette &palette) { Q_D(QGraphicsScene); QPalette naturalPalette = QGuiApplication::palette(); - naturalPalette.resolve(0); + naturalPalette.setResolveMask(0); QPalette resolvedPalette = palette.resolve(naturalPalette); d->setPalette_helper(resolvedPalette); } diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 530f7aee7a..fea9e18b9c 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -977,13 +977,13 @@ QFont QGraphicsWidget::font() const { Q_D(const QGraphicsWidget); QFont fnt = d->font; - fnt.resolve(fnt.resolve() | d->inheritedFontResolveMask); + fnt.setResolveMask(fnt.resolveMask() | d->inheritedFontResolveMask); return fnt; } void QGraphicsWidget::setFont(const QFont &font) { Q_D(QGraphicsWidget); - setAttribute(Qt::WA_SetFont, font.resolve() != 0); + setAttribute(Qt::WA_SetFont, font.resolveMask() != 0); QFont naturalFont = d->naturalWidgetFont(); QFont resolvedFont = font.resolve(naturalFont); @@ -1023,7 +1023,7 @@ QPalette QGraphicsWidget::palette() const void QGraphicsWidget::setPalette(const QPalette &palette) { Q_D(QGraphicsWidget); - setAttribute(Qt::WA_SetPalette, palette.resolve() != 0); + setAttribute(Qt::WA_SetPalette, palette.resolveMask() != 0); QPalette naturalPalette = d->naturalWidgetPalette(); QPalette resolvedPalette = palette.resolve(naturalPalette); diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index e6f39d6803..c1a24932fe 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -150,7 +150,7 @@ void QGraphicsWidgetPrivate::ensureWindowData() void QGraphicsWidgetPrivate::setPalette_helper(const QPalette &palette) { - if (this->palette == palette && this->palette.resolve() == palette.resolve()) + if (this->palette == palette && this->palette.resolveMask() == palette.resolveMask()) return; updatePalette(palette); } @@ -172,7 +172,7 @@ void QGraphicsWidgetPrivate::updatePalette(const QPalette &palette) // Calculate new mask. if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) inheritedPaletteResolveMask = 0; - int mask = palette.resolve() | inheritedPaletteResolveMask; + int mask = palette.resolveMask() | inheritedPaletteResolveMask; // Propagate to children. for (int i = 0; i < children.size(); ++i) { @@ -239,13 +239,13 @@ QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const } else if (scene) { palette = scene->palette(); } - palette.resolve(0); + palette.setResolveMask(0); return palette; } void QGraphicsWidgetPrivate::setFont_helper(const QFont &font) { - if (this->font == font && this->font.resolve() == font.resolve()) + if (this->font == font && this->font.resolveMask() == font.resolveMask()) return; updateFont(font); } @@ -270,7 +270,7 @@ void QGraphicsWidgetPrivate::updateFont(const QFont &font) // Calculate new mask. if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) inheritedFontResolveMask = 0; - int mask = font.resolve() | inheritedFontResolveMask; + int mask = font.resolveMask() | inheritedFontResolveMask; // Propagate to children. for (int i = 0; i < children.size(); ++i) { @@ -300,7 +300,7 @@ QFont QGraphicsWidgetPrivate::naturalWidgetFont() const } else if (scene) { naturalFont = scene->font(); } - naturalFont.resolve(0); + naturalFont.setResolveMask(0); return naturalFont; } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index fa64a3925d..71e18b5af5 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1185,9 +1185,9 @@ void QApplication::setPalette(const QPalette &palette, const char* className) if (className) { QPalette polishedPalette = palette; if (QApplicationPrivate::app_style) { - auto originalResolveMask = palette.resolve(); + auto originalResolveMask = palette.resolveMask(); QApplicationPrivate::app_style->polish(polishedPalette); - polishedPalette.resolve(originalResolveMask); + polishedPalette.setResolveMask(originalResolveMask); } QApplicationPrivate::widgetPalettes.insert(className, polishedPalette); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f21d148c00..9a3ba96d19 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1831,14 +1831,14 @@ void QWidgetPrivate::propagatePaletteChange() #if QT_CONFIG(graphicsview) if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; - inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve(); + inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolveMask(); } else #endif // QT_CONFIG(graphicsview) if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedPaletteResolveMask = 0; } - directPaletteResolveMask = data.pal.resolve(); + directPaletteResolveMask = data.pal.resolveMask(); auto mask = directPaletteResolveMask | inheritedPaletteResolveMask; const bool useStyleSheetPropagationInWidgetStyles = @@ -4376,7 +4376,7 @@ const QPalette &QWidget::palette() const void QWidget::setPalette(const QPalette &palette) { Q_D(QWidget); - setAttribute(Qt::WA_SetPalette, palette.resolve() != 0); + setAttribute(Qt::WA_SetPalette, palette.resolveMask() != 0); // Determine which palette is inherited from this widget's ancestors and // QApplication::palette, resolve this against \a palette (attributes from @@ -4414,7 +4414,7 @@ QPalette QWidgetPrivate::naturalWidgetPalette(QPalette::ResolveMask inheritedMas if (!p->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) { if (!naturalPalette.isCopyOf(QGuiApplication::palette())) { QPalette inheritedPalette = p->palette(); - inheritedPalette.resolve(inheritedMask); + inheritedPalette.setResolveMask(inheritedMask); naturalPalette = inheritedPalette.resolve(naturalPalette); } else { naturalPalette = p->palette(); @@ -4424,12 +4424,12 @@ QPalette QWidgetPrivate::naturalWidgetPalette(QPalette::ResolveMask inheritedMas #if QT_CONFIG(graphicsview) else if (extra && extra->proxyWidget) { QPalette inheritedPalette = extra->proxyWidget->palette(); - inheritedPalette.resolve(inheritedMask); + inheritedPalette.setResolveMask(inheritedMask); naturalPalette = inheritedPalette.resolve(naturalPalette); } #endif // QT_CONFIG(graphicsview) } - naturalPalette.resolve(0); + naturalPalette.setResolveMask(0); return naturalPalette; } /*! @@ -4450,7 +4450,7 @@ void QWidgetPrivate::resolvePalette() void QWidgetPrivate::setPalette_helper(const QPalette &palette) { Q_Q(QWidget); - if (data.pal == palette && data.pal.resolve() == palette.resolve()) + if (data.pal == palette && data.pal.resolveMask() == palette.resolveMask()) return; data.pal = palette; updateSystemBackground(); @@ -4520,7 +4520,7 @@ void QWidget::setFont(const QFont &font) style->saveWidgetFont(this, font); #endif - setAttribute(Qt::WA_SetFont, font.resolve() != 0); + setAttribute(Qt::WA_SetFont, font.resolveMask() != 0); // Determine which font is inherited from this widget's ancestors and // QApplication::font, resolve this against \a font (attributes from the @@ -4562,7 +4562,7 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const if (!naturalFont.isCopyOf(QApplication::font())) { if (inheritedMask != 0) { QFont inheritedFont = p->font(); - inheritedFont.resolve(inheritedMask); + inheritedFont.setResolveMask(inheritedMask); naturalFont = inheritedFont.resolve(naturalFont); } // else nothing to do (naturalFont = naturalFont) } else { @@ -4574,13 +4574,13 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const else if (extra && extra->proxyWidget) { if (inheritedMask != 0) { QFont inheritedFont = extra->proxyWidget->font(); - inheritedFont.resolve(inheritedMask); + inheritedFont.setResolveMask(inheritedMask); naturalFont = inheritedFont.resolve(naturalFont); } // else nothing to do (naturalFont = naturalFont) } #endif // QT_CONFIG(graphicsview) } - naturalFont.resolve(0); + naturalFont.setResolveMask(0); return naturalFont; } @@ -4592,7 +4592,7 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const QFont QWidgetPrivate::localFont() const { QFont localfont = data.fnt; - localfont.resolve(directFontResolveMask); + localfont.setResolveMask(directFontResolveMask); return localfont; } @@ -4636,18 +4636,18 @@ void QWidgetPrivate::updateFont(const QFont &font) #if QT_CONFIG(graphicsview) if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; - inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); + inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolveMask(); } else #endif // QT_CONFIG(graphicsview) if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedFontResolveMask = 0; } - uint newMask = data.fnt.resolve() | inheritedFontResolveMask; + uint newMask = data.fnt.resolveMask() | inheritedFontResolveMask; // Set the font as also having resolved inherited traits, so the result of reading QWidget::font() // isn't all weak information, but save the original mask to be able to let new changes on the // parent widget font propagate correctly. - directFontResolveMask = data.fnt.resolve(); - data.fnt.resolve(newMask); + directFontResolveMask = data.fnt.resolveMask(); + data.fnt.setResolveMask(newMask); for (int i = 0; i < children.size(); ++i) { QWidget *w = qobject_cast<QWidget*>(children.at(i)); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index f6a1ee539d..d27a955c81 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -313,7 +313,7 @@ public: void updateFont(const QFont &); inline void setFont_helper(const QFont &font) { - if (directFontResolveMask == font.resolve() && data.fnt == font) + if (directFontResolveMask == font.resolveMask() && data.fnt == font) return; updateFont(font); } @@ -682,7 +682,7 @@ public: // Other variables. uint directFontResolveMask; uint inheritedFontResolveMask; - decltype(std::declval<QPalette>().resolve()) directPaletteResolveMask; + decltype(std::declval<QPalette>().resolveMask()) directPaletteResolveMask; QPalette::ResolveMask inheritedPaletteResolveMask; short leftmargin; short topmargin; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index b2b72fb6a8..2f38b72c21 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2679,13 +2679,13 @@ void QStyleSheetStyle::setPalette(QWidget *w) rule.configurePalette(&p, map[i].group, ew, ew != w); } - if (!useStyleSheetPropagationInWidgetStyles || p.resolve() != 0) { + if (!useStyleSheetPropagationInWidgetStyles || p.resolveMask() != 0) { QPalette wp = w->palette(); - styleSheetCaches->customPaletteWidgets.insert(w, {wp, p.resolve()}); + styleSheetCaches->customPaletteWidgets.insert(w, {wp, p.resolveMask()}); if (useStyleSheetPropagationInWidgetStyles) { p = p.resolve(wp); - p.resolve(p.resolve() | wp.resolve()); + p.setResolveMask(p.resolveMask() | wp.resolveMask()); } w->setPalette(p); @@ -6109,18 +6109,18 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const if (useStyleSheetPropagationInWidgetStyles) { unsetStyleSheetFont(w); - if (rule.font.resolve()) { + if (rule.font.resolveMask()) { QFont wf = w->d_func()->localFont(); - styleSheetCaches->customFontWidgets.insert(w, {wf, rule.font.resolve()}); + styleSheetCaches->customFontWidgets.insert(w, {wf, rule.font.resolveMask()}); QFont font = rule.font.resolve(wf); - font.resolve(wf.resolve() | rule.font.resolve()); + font.setResolveMask(wf.resolveMask() | rule.font.resolveMask()); w->setFont(font); } } else { QFont wf = w->d_func()->localFont(); QFont font = rule.font.resolve(wf); - font.resolve(wf.resolve() | rule.font.resolve()); + font.setResolveMask(wf.resolveMask() | rule.font.resolveMask()); if ((!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) && isNaturalChild(w) && qobject_cast<QWidget *>(w->parent())) { @@ -6128,11 +6128,11 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const font = font.resolve(static_cast<QWidget *>(w->parent())->font()); } - if (wf.resolve() == font.resolve() && wf == font) + if (wf.resolveMask() == font.resolveMask() && wf == font) return; w->data->fnt = font; - w->d_func()->directFontResolveMask = font.resolve(); + w->d_func()->directFontResolveMask = font.resolveMask(); QEvent e(QEvent::FontChange); QCoreApplication::sendEvent(w, &e); diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h index 879ddec4d3..fa8a0955a7 100644 --- a/src/widgets/styles/qstylesheetstyle_p.h +++ b/src/widgets/styles/qstylesheetstyle_p.h @@ -194,7 +194,7 @@ public: template <typename T> struct Tampered { T oldWidgetValue; - decltype(std::declval<T>().resolve()) resolveMask; + decltype(std::declval<T>().resolveMask()) resolveMask; // only call this function on an rvalue *this (it mangles oldWidgetValue) T reverted(T current) @@ -202,10 +202,10 @@ public: && #endif { - oldWidgetValue.resolve(oldWidgetValue.resolve() & resolveMask); - current.resolve(current.resolve() & ~resolveMask); + oldWidgetValue.setResolveMask(oldWidgetValue.resolveMask() & resolveMask); + current.setResolveMask(current.resolveMask() & ~resolveMask); current.resolve(oldWidgetValue); - current.resolve(current.resolve() | oldWidgetValue.resolve()); + current.setResolveMask(current.resolveMask() | oldWidgetValue.resolveMask()); return current; } }; diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 0d8e68f3f8..e0415441b9 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -510,7 +510,7 @@ void tst_QGuiApplication::keyboardModifiers() */ static bool palettesMatch(const QPalette &actual, const QPalette &expected) { - if (actual.resolve() != expected.resolve()) + if (actual.resolveMask() != expected.resolveMask()) return false; for (int i = 0; i < QPalette::NColorGroups; i++) { @@ -541,7 +541,7 @@ void tst_QGuiApplication::palette() QCOMPARE(QGuiApplication::palette(), QPalette()); // The default application palette is not resolved - QVERIFY(!QGuiApplication::palette().resolve()); + QVERIFY(!QGuiApplication::palette().resolveMask()); QSignalSpy signalSpy(&app, SIGNAL(paletteChanged(QPalette))); diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 04343727bb..cd968100e6 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -132,7 +132,7 @@ static void compareAllPaletteData(const QPalette &firstPalette, const QPalette & // For historical reasons, operator== compares only brushes, but it's not enough for proper // comparison after move/copy, because some additional data can also be moved/copied. // Let's compare this data here. - QCOMPARE(firstPalette.resolve(), secondPalette.resolve()); + QCOMPARE(firstPalette.resolveMask(), secondPalette.resolveMask()); QCOMPARE(firstPalette.currentColorGroup(), secondPalette.currentColorGroup()); } @@ -233,7 +233,7 @@ void tst_QPalette::setAllPossibleBrushes() { QPalette p; - QCOMPARE(p.resolve(), QPalette::ResolveMask(0)); + QCOMPARE(p.resolveMask(), QPalette::ResolveMask(0)); for (int r = 0; r < QPalette::NColorRoles; ++r) { p.setBrush(QPalette::All, QPalette::ColorRole(r), Qt::red); @@ -248,7 +248,7 @@ void tst_QPalette::setAllPossibleBrushes() void tst_QPalette::noBrushesSetForDefaultPalette() { - QCOMPARE(QPalette().resolve(), QPalette::ResolveMask(0)); + QCOMPARE(QPalette().resolveMask(), QPalette::ResolveMask(0)); } void tst_QPalette::cannotCheckIfInvalidBrushSet() diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 83d8d01062..5e4fdfcdc9 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -322,22 +322,22 @@ void tst_QFont::resetFont() QWidget secondChild(&parent); secondChild.setFont(childFont); - QVERIFY(parentFont.resolve() != 0); - QVERIFY(childFont.resolve() != 0); + QVERIFY(parentFont.resolveMask() != 0); + QVERIFY(childFont.resolveMask() != 0); QVERIFY(childFont != parentFont); // reset font on both children firstChild.setFont(QFont()); secondChild.setFont(QFont()); - QCOMPARE(firstChild.font().resolve(), QFont::SizeResolved); - QCOMPARE(secondChild.font().resolve(), QFont::SizeResolved); + QCOMPARE(firstChild.font().resolveMask(), QFont::SizeResolved); + QCOMPARE(secondChild.font().resolveMask(), QFont::SizeResolved); #ifdef Q_OS_ANDROID QEXPECT_FAIL("", "QTBUG-69214", Continue); #endif QCOMPARE(firstChild.font().pointSize(), parent.font().pointSize()); QCOMPARE(secondChild.font().pointSize(), parent.font().pointSize()); - QVERIFY(parent.font().resolve() != 0); + QVERIFY(parent.font().resolveMask() != 0); } #endif diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index 7548dbb8e4..ef5e3a0e0b 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -535,19 +535,19 @@ void tst_QTextFormat::setFont() QCOMPARE((int)f.font().capitalization(), (int)f.fontCapitalization()); QCOMPARE(f.font().kerning(), f.fontKerning()); - if (overrideAll || (font2.resolve() & QFont::StyleHintResolved)) + if (overrideAll || (font2.resolveMask() & QFont::StyleHintResolved)) QCOMPARE((int)f.font().styleHint(), (int)font2.styleHint()); else QCOMPARE((int)f.font().styleHint(), (int)font1.styleHint()); - if (overrideAll || (font2.resolve() & QFont::StyleStrategyResolved)) + if (overrideAll || (font2.resolveMask() & QFont::StyleStrategyResolved)) QCOMPARE((int)f.font().styleStrategy(), (int)font2.styleStrategy()); else QCOMPARE((int)f.font().styleStrategy(), (int)font1.styleStrategy()); - if (overrideAll || (font2.resolve() & QFont::CapitalizationResolved)) + if (overrideAll || (font2.resolveMask() & QFont::CapitalizationResolved)) QCOMPARE((int)f.font().capitalization(), (int)font2.capitalization()); else QCOMPARE((int)f.font().capitalization(), (int)font1.capitalization()); - if (overrideAll || (font2.resolve() & QFont::KerningResolved)) + if (overrideAll || (font2.resolveMask() & QFont::KerningResolved)) QCOMPARE(f.font().kerning(), font2.kerning()); else QCOMPARE(f.font().kerning(), font1.kerning()); @@ -639,19 +639,19 @@ void tst_QTextFormat::setFont_collection() int formatIndex = collection.indexForFormat(tmp); QTextCharFormat f = collection.charFormat(formatIndex); - if (overrideAll || (font2.resolve() & QFont::StyleHintResolved)) + if (overrideAll || (font2.resolveMask() & QFont::StyleHintResolved)) QCOMPARE((int)f.font().styleHint(), (int)font2.styleHint()); else QCOMPARE((int)f.font().styleHint(), (int)font1.styleHint()); - if (overrideAll || (font2.resolve() & QFont::StyleStrategyResolved)) + if (overrideAll || (font2.resolveMask() & QFont::StyleStrategyResolved)) QCOMPARE((int)f.font().styleStrategy(), (int)font2.styleStrategy()); else QCOMPARE((int)f.font().styleStrategy(), (int)font1.styleStrategy()); - if (overrideAll || (font2.resolve() & QFont::CapitalizationResolved)) + if (overrideAll || (font2.resolveMask() & QFont::CapitalizationResolved)) QCOMPARE((int)f.font().capitalization(), (int)font2.capitalization()); else QCOMPARE((int)f.font().capitalization(), (int)font1.capitalization()); - if (overrideAll || (font2.resolve() & QFont::KerningResolved)) + if (overrideAll || (font2.resolveMask() & QFont::KerningResolved)) QCOMPARE(f.font().kerning(), font2.kerning()); else QCOMPARE(f.font().kerning(), font1.kerning()); diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 882aa8bcbd..4298cc3da7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -640,11 +640,11 @@ void tst_QGraphicsWidget::fontPropagatesResolveToChildren() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); - QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(root->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child2->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child3->font().resolveMask(), uint(QFont::StyleResolved)); } void tst_QGraphicsWidget::fontPropagatesResolveToGrandChildren() @@ -675,12 +675,12 @@ void tst_QGraphicsWidget::fontPropagatesResolveToGrandChildren() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved)); } void tst_QGraphicsWidget::fontPropagatesResolveViaNonWidget() @@ -711,12 +711,12 @@ void tst_QGraphicsWidget::fontPropagatesResolveViaNonWidget() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved)); } void tst_QGraphicsWidget::fontPropagatesResolveFromScene() @@ -747,16 +747,16 @@ void tst_QGraphicsWidget::fontPropagatesResolveFromScene() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); - QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(font.resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(root->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child2->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(child3->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolveMask(), uint(QFont::StyleResolved)); } void tst_QGraphicsWidget::fontPropagatesResolveInParentChange() @@ -785,8 +785,8 @@ void tst_QGraphicsWidget::fontPropagatesResolveInParentChange() QVERIFY(!grandChild2->font().italic()); QVERIFY(grandChild2->font().bold()); - QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild2->font().resolve(), uint(QFont::WeightResolved)); + QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::WeightResolved)); grandChild2->setParentItem(child1); @@ -800,8 +800,8 @@ void tst_QGraphicsWidget::fontPropagatesResolveInParentChange() QVERIFY(grandChild2->font().italic()); QVERIFY(!grandChild2->font().bold()); - QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); - QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolveMask(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolveMask(), uint(QFont::StyleResolved)); } @@ -911,12 +911,12 @@ void tst_QGraphicsWidget::fontPropagationWidgetItemWidget() widget->setFont(font); QCOMPARE(widget2->font().pointSize(), 43); - QCOMPARE(widget2->font().resolve(), uint(QFont::SizeResolved)); + QCOMPARE(widget2->font().resolveMask(), uint(QFont::SizeResolved)); widget->setFont(QFont()); QCOMPARE(widget2->font().pointSize(), qApp->font().pointSize()); - QCOMPARE(widget2->font().resolve(), QFont().resolve()); + QCOMPARE(widget2->font().resolveMask(), QFont().resolveMask()); } void tst_QGraphicsWidget::fontPropagationSceneChange() diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 611ae3474b..0ba42c0e36 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -1836,7 +1836,7 @@ void tst_QApplication::applicationPalettePolish() qputenv("QT_DESKTOP_STYLE_KEY", "customstyle"); QApplication app(argc, &argv0); QVERIFY(CustomStyle::polished); - QVERIFY(!app.palette().resolve()); + QVERIFY(!app.palette().resolveMask()); QCOMPARE(app.palette().color(QPalette::Link), Qt::red); qunsetenv("QT_DESKTOP_STYLE_KEY"); } @@ -1846,7 +1846,7 @@ void tst_QApplication::applicationPalettePolish() QApplication::setStyle(new CustomStyle); QApplication app(argc, &argv0); QVERIFY(CustomStyle::polished); - QVERIFY(!app.palette().resolve()); + QVERIFY(!app.palette().resolveMask()); QCOMPARE(app.palette().color(QPalette::Link), Qt::red); } @@ -1854,13 +1854,13 @@ void tst_QApplication::applicationPalettePolish() QApplication app(argc, &argv0); app.setStyle(new CustomStyle); QVERIFY(CustomStyle::polished); - QVERIFY(!app.palette().resolve()); + QVERIFY(!app.palette().resolveMask()); QCOMPARE(app.palette().color(QPalette::Link), Qt::red); CustomStyle::polished = 0; app.setPalette(QPalette()); QVERIFY(CustomStyle::polished); - QVERIFY(!app.palette().resolve()); + QVERIFY(!app.palette().resolveMask()); QCOMPARE(app.palette().color(QPalette::Link), Qt::red); CustomStyle::polished = 0; @@ -1868,7 +1868,7 @@ void tst_QApplication::applicationPalettePolish() palette.setColor(QPalette::Active, QPalette::Highlight, Qt::green); app.setPalette(palette); QVERIFY(CustomStyle::polished); - QVERIFY(app.palette().resolve()); + QVERIFY(app.palette().resolveMask()); QCOMPARE(app.palette().color(QPalette::Link), Qt::red); QCOMPARE(app.palette().color(QPalette::Highlight), Qt::green); } diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 00939e5118..b61faf6c2b 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -2111,13 +2111,13 @@ void tst_QStyleSheetStyle::widgetStylePropagation() QLabel childLabel(&parentLabel); childLabel.setObjectName("childLabel"); - if (parentFont.resolve()) + if (parentFont.resolveMask()) parentLabel.setFont(parentFont); - if (childFont.resolve()) + if (childFont.resolveMask()) childLabel.setFont(childFont); - if (parentPalette.resolve()) + if (parentPalette.resolveMask()) parentLabel.setPalette(parentPalette); - if (childPalette.resolve()) + if (childPalette.resolveMask()) childLabel.setPalette(childPalette); if (!parentStyleSheet.isEmpty()) parentLabel.setStyleSheet(parentStyleSheet); diff --git a/tests/manual/textrendering/nativetext/main.cpp b/tests/manual/textrendering/nativetext/main.cpp index b481e44bae..ae87dfa929 100644 --- a/tests/manual/textrendering/nativetext/main.cpp +++ b/tests/manual/textrendering/nativetext/main.cpp @@ -125,7 +125,7 @@ public: p.setPen(palette().text().color()); QFont f = font(); - f.resolve(-1); + f.setResolveMask(-1); p.setFont(f); p.drawText(QPoint(0, ascent), text()); |