Remove usages of deprecated APIs

Replaced:
  QPalette::ColorRole::Background -> QPalette::ColorRole::Window
  QPalette::ColorRole::Foreground -> QPalette::ColorRole::WindowText
  Qt::ItemDataRole::TextColorRole -> Qt::ItemDataRole::ForegroundRole
  QFontMetrics::width() -> QFontMetrics::horizontalAdvance()

Task-number: QTBUG-76491
Change-Id: I1302e6b569e725daa6f7be1428ffe055657fc644
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Sona Kurazyan
2019-08-29 11:40:38 +02:00
parent 6f4aa0458c
commit 82bcf4e9f5
22 changed files with 52 additions and 59 deletions

View File

@@ -246,14 +246,12 @@ QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false)
QPalette pal = oldPalette;
pal.setBrush(QPalette::All, QPalette::WindowText, color);
pal.setBrush(QPalette::All, QPalette::ButtonText, color);
pal.setBrush(QPalette::All, QPalette::Foreground, color);
if (lightColored)
color.setAlpha(100);
else
color = creatorTheme()->color(Theme::IconsDisabledColor);
pal.setBrush(QPalette::Disabled, QPalette::WindowText, color);
pal.setBrush(QPalette::Disabled, QPalette::ButtonText, color);
pal.setBrush(QPalette::Disabled, QPalette::Foreground, color);
return pal;
}
@@ -291,7 +289,7 @@ void ManhattanStyle::polish(QWidget *widget)
const bool isLightColored = lightColored(widget);
QPalette palette = panelPalette(widget->palette(), isLightColored);
if (!isLightColored)
palette.setBrush(QPalette::All, QPalette::Foreground,
palette.setBrush(QPalette::All, QPalette::WindowText,
creatorTheme()->color(Theme::ComboBoxTextColor));
widget->setPalette(palette);
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
@@ -738,7 +736,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
}
painter->setPen((option->state & State_Enabled)
? option->palette.color(QPalette::Foreground)
? option->palette.color(QPalette::WindowText)
: creatorTheme()->color(Theme::IconsDisabledColor));
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);