Remove duplicate aplication of scaling factor. (#2461)

This commit is contained in:
karliss 2020-11-04 18:39:12 +02:00 committed by GitHub
parent 8ba2164d00
commit 81ef309e09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ void ColorOptionDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option, const QStyleOptionViewItem &option,
const QModelIndex &index) const const QModelIndex &index) const
{ {
int margin = this->margin * qhelpers::devicePixelRatio(painter->device()); int margin = this->margin;
painter->save(); painter->save();
painter->setFont(option.font); painter->setFont(option.font);
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
@ -140,7 +140,7 @@ void ColorOptionDelegate::paint(QPainter *painter,
// Create chess-like pattern of black and white squares // Create chess-like pattern of black and white squares
// and fill background of roundedColorRect with it // and fill background of roundedColorRect with it
if (currCO.color.alpha() < 255) { if (currCO.color.alpha() < 255) {
const int c1 = static_cast<int>(8 * qhelpers::devicePixelRatio(painter->device())); const int c1 = static_cast<int>(8);
const int c2 = c1 / 2; const int c2 = c1 / 2;
QPixmap p(c1, c1); QPixmap p(c1, c1);
QPainter paint(&p); QPainter paint(&p);
@ -167,7 +167,7 @@ void ColorOptionDelegate::paint(QPainter *painter,
QSize ColorOptionDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const QSize ColorOptionDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{ {
qreal margin = this->margin * qhelpers::devicePixelRatio(option.widget); qreal margin = this->margin;
qreal fontHeight = option.fontMetrics.height(); qreal fontHeight = option.fontMetrics.height();
qreal h = QPen().width(); qreal h = QPen().width();
h += fontHeight; // option name h += fontHeight; // option name