m_expansionArea(),
m_customTextColor(),
m_additionalInfoTextColor(),
- m_overlay(),
- m_selectionTogglePos()
+ m_overlay()
{
for (int i = 0; i < TextIdCount; ++i) {
m_text[i].setTextFormat(Qt::PlainText);
toggleSize = KIconLoader::SizeSmallMedium;
}
- QPointF pos = m_selectionTogglePos;
+ QPointF pos = iconRect().topLeft();
// If the selection toggle has a very small distance to the
// widget borders, the size of the selection toggle will get
{
if (m_customTextColor.isValid()) {
return m_customTextColor;
- } else if (isSelected()) {
- return styleOption().palette.highlightedText().color();
- } else {
- return styleOption().palette.text().color();
}
+
+ const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
+ const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : QPalette::Text;
+ return styleOption().palette.brush(group, role).color();
}
void KFileItemListWidget::setOverlay(const QPixmap& overlay)
}
if (updatePixmap) {
- // The selection toggle should always be applied to the top/left
- // of the pixmap
- m_selectionTogglePos = QPointF(-option.margin, -option.margin);
-
m_pixmap = values["iconPixmap"].value<QPixmap>();
if (m_pixmap.isNull()) {
// Use the icon that fits to the MIME-type
y = (iconHeight - m_pixmap.height()) / 2; // Center vertically
painter.drawPixmap(x, y, m_pixmap);
}
- m_selectionTogglePos += QPointF(x, y);
m_pixmap = squarePixmap;
} else {
}
m_pixmapPos.setY(option.margin);
- if (updatePixmap) {
- m_selectionTogglePos += m_pixmapPos;
- }
-
// Center the hover rectangle horizontally and align it on bottom
const qreal x = m_pixmapPos.x() + (m_scaledPixmapSize.width() - m_hoverPixmapRect.width()) / 2.0;
const qreal y = m_pixmapPos.y() + m_scaledPixmapSize.height() - m_hoverPixmapRect.height();