Lines 584-590
Link Here
|
584 |
//QPixmap icon = value.value<QPixmap>(); //pixmap(column); |
584 |
//QPixmap icon = value.value<QPixmap>(); //pixmap(column); |
585 |
if(!icon.isNull()) |
585 |
if(!icon.isNull()) |
586 |
{ |
586 |
{ |
587 |
int yOffset = (sizeHint(option, index).height() - icon.height()) / 2; |
587 |
const auto dpr = thePainter->device()->devicePixelRatioF(); |
|
|
588 |
const int w = qRound(icon.width() / dpr); |
589 |
const int h = qRound(icon.height() / dpr); |
590 |
int yOffset = (sizeHint(option, index).height() - h) / 2; |
588 |
thePainter->drawPixmap(x + 2, y + yOffset, icon); |
591 |
thePainter->drawPixmap(x + 2, y + yOffset, icon); |
589 |
|
592 |
|
590 |
int i = index == d->m_selection1Index ? 1 : index == d->m_selection2Index ? 2 : index == d->m_selection3Index ? 3 : 0; |
593 |
int i = index == d->m_selection1Index ? 1 : index == d->m_selection2Index ? 2 : index == d->m_selection3Index ? 3 : 0; |
Lines 593-612
Link Here
|
593 |
Options* pOpts = d->m_pOptions; |
596 |
Options* pOpts = d->m_pOptions; |
594 |
QColor c(i == 1 ? pOpts->m_colorA : i == 2 ? pOpts->m_colorB : pOpts->m_colorC); |
597 |
QColor c(i == 1 ? pOpts->m_colorA : i == 2 ? pOpts->m_colorB : pOpts->m_colorC); |
595 |
thePainter->setPen(c); // highlight() ); |
598 |
thePainter->setPen(c); // highlight() ); |
596 |
thePainter->drawRect(x + 2, y + yOffset, icon.width(), icon.height()); |
599 |
thePainter->drawRect(x + 2, y + yOffset, w, h); |
597 |
thePainter->setPen(QPen(c, 0, Qt::DotLine)); |
600 |
thePainter->setPen(QPen(c, 0, Qt::DotLine)); |
598 |
thePainter->drawRect(x + 1, y + yOffset - 1, icon.width() + 2, icon.height() + 2); |
601 |
thePainter->drawRect(x + 1, y + yOffset - 1, w + 2, h + 2); |
599 |
thePainter->setPen(Qt::white); |
602 |
thePainter->setPen(Qt::white); |
600 |
QString s(QChar('A' + i - 1)); |
603 |
QString s(QChar('A' + i - 1)); |
601 |
|
604 |
|
602 |
thePainter->drawText(x + 2 + (icon.width() - Utils::getHorizontalAdvance(thePainter->fontMetrics(), s)) / 2, |
605 |
thePainter->drawText(x + 2 + (w - Utils::getHorizontalAdvance(thePainter->fontMetrics(), s)) / 2, |
603 |
y + yOffset + (icon.height() + thePainter->fontMetrics().ascent()) / 2 - 1, |
606 |
y + yOffset + (h + thePainter->fontMetrics().ascent()) / 2 - 1, |
604 |
s); |
607 |
s); |
605 |
} |
608 |
} |
606 |
else |
609 |
else |
607 |
{ |
610 |
{ |
608 |
thePainter->setPen(m_pDMW->palette().window().color()); |
611 |
thePainter->setPen(m_pDMW->palette().window().color()); |
609 |
thePainter->drawRect(x + 1, y + yOffset - 1, icon.width() + 2, icon.height() + 2); |
612 |
thePainter->drawRect(x + 1, y + yOffset - 1, w + 2, h + 2); |
610 |
} |
613 |
} |
611 |
return; |
614 |
return; |
612 |
} |
615 |
} |