Widgets: replace deprecated QPalette functions
QPalette::foreground()/background() are deprecated since 5.13 - replace those functions with their successors. Change-Id: I80e49dadd7be1007d73ac920f6db2b8e608db06a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
9c2cb3d83e
commit
108f0cc998
@ -842,8 +842,8 @@ void QColorLuminancePicker::paintEvent(QPaintEvent *)
|
||||
p.drawPixmap(1, coff, *pix);
|
||||
const QPalette &g = palette();
|
||||
qDrawShadePanel(&p, r, g, true);
|
||||
p.setPen(g.foreground().color());
|
||||
p.setBrush(g.foreground());
|
||||
p.setPen(g.windowText().color());
|
||||
p.setBrush(g.windowText());
|
||||
QPolygon a;
|
||||
int y = val2y(val);
|
||||
a.setPoints(3, w, y, w+5, y+5, w+5, y-5);
|
||||
|
@ -1766,7 +1766,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled)
|
||||
? QPalette::Normal : QPalette::Disabled;
|
||||
o.backgroundColor = option.palette.color(cg, d->selectionModel->isSelected(index)
|
||||
? QPalette::Highlight : QPalette::Background);
|
||||
? QPalette::Highlight : QPalette::Window);
|
||||
int x = 0;
|
||||
if (!option.showDecorationSelected)
|
||||
x = header->sectionPosition(0) + d->indentationForItem(d->current);
|
||||
|
@ -166,7 +166,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
|
||||
break;
|
||||
}
|
||||
if (index.data(Qt::BackgroundRole).canConvert<QBrush>()) {
|
||||
menuOption.palette.setBrush(QPalette::All, QPalette::Background,
|
||||
menuOption.palette.setBrush(QPalette::All, QPalette::Window,
|
||||
qvariant_cast<QBrush>(index.data(Qt::BackgroundRole)));
|
||||
}
|
||||
menuOption.text = index.model()->data(index, Qt::DisplayRole).toString()
|
||||
|
@ -277,7 +277,7 @@ protected:
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override {
|
||||
QStyleOptionMenuItem opt = getStyleOption(option, index);
|
||||
painter->fillRect(option.rect, opt.palette.background());
|
||||
painter->fillRect(option.rect, opt.palette.window());
|
||||
mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo);
|
||||
}
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
|
@ -2038,7 +2038,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
|
||||
|
||||
if (backgroundVisible() && !block.isValid() && offset.y() <= er.bottom()
|
||||
&& (centerOnScroll() || verticalScrollBar()->maximum() == verticalScrollBar()->minimum())) {
|
||||
painter.fillRect(QRect(QPoint((int)er.left(), (int)offset.y()), er.bottomRight()), palette().background());
|
||||
painter.fillRect(QRect(QPoint((int)er.left(), (int)offset.y()), er.bottomRight()), palette().window());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ void QStatusBar::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
}
|
||||
if (haveMessage) {
|
||||
p.setPen(palette().foreground().color());
|
||||
p.setPen(palette().windowText().color());
|
||||
p.drawText(d->messageRect(), Qt::AlignLeading | Qt::AlignVCenter | Qt::TextSingleLine, d->tempItem);
|
||||
}
|
||||
}
|
||||
|
@ -1045,7 +1045,7 @@ void QToolBar::paintEvent(QPaintEvent *)
|
||||
if (d->layout->expanded || d->layout->animating || isWindow()) {
|
||||
//if the toolbar is expended, we need to fill the background with the window color
|
||||
//because some styles may expects that.
|
||||
p.fillRect(opt.rect, palette().background());
|
||||
p.fillRect(opt.rect, palette().window());
|
||||
style->drawControl(QStyle::CE_ToolBar, &opt, &p, this);
|
||||
style->drawPrimitive(QStyle::PE_FrameMenu, &opt, &p, this);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user