Paint text of selected items with correct color
This commit is contained in:
parent
a92e221fcc
commit
3bb28130f3
|
@ -47,15 +47,12 @@ void DevButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
QTextOption textOption;
|
QTextOption textOption;
|
||||||
textOption.setAlignment(opt.displayAlignment);
|
textOption.setAlignment(opt.displayAlignment);
|
||||||
painter->setFont(opt.font);
|
painter->setFont(opt.font);
|
||||||
painter->setPen(opt.palette.color(QPalette::Text));
|
painter->setPen(opt.palette.color(opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text));
|
||||||
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
||||||
|
|
||||||
// draw buttons
|
// draw buttons
|
||||||
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
||||||
//painter->drawPixmap(option.rect.right() - 34, buttonY, 16, 16, m_refreshIcon);
|
|
||||||
//if(!index.data(SyncthingDeviceModel::IsOwnDevice).toBool()) {
|
|
||||||
painter->drawPixmap(option.rect.right() - 16, buttonY, 16, 16, index.data(SyncthingDeviceModel::DevicePaused).toBool() ? m_resumeIcon : m_pauseIcon);
|
painter->drawPixmap(option.rect.right() - 16, buttonY, 16, 16, index.data(SyncthingDeviceModel::DevicePaused).toBool() ? m_resumeIcon : m_pauseIcon);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ void DirButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
QTextOption textOption;
|
QTextOption textOption;
|
||||||
textOption.setAlignment(opt.displayAlignment);
|
textOption.setAlignment(opt.displayAlignment);
|
||||||
painter->setFont(opt.font);
|
painter->setFont(opt.font);
|
||||||
painter->setPen(opt.palette.color(QPalette::Text));
|
painter->setPen(opt.palette.color(opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text));
|
||||||
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
||||||
|
|
||||||
// draw buttons
|
// draw buttons
|
||||||
|
|
Loading…
Reference in New Issue