X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c2c075011c0924fb6af3ae345f839620ea78afc2..5f57256a2f293622c7a10844adae29190907b9eb:/src/kitemviews/kstandarditemlistwidget.cpp diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 8740cb73f..aa12f884c 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -273,8 +273,8 @@ KStandardItemListWidget::KStandardItemListWidget(KItemListWidgetInformant* infor m_additionalInfoTextColor(), m_overlay(), m_rating(), - m_roleEditor(0), - m_oldRoleEditor(0) + m_roleEditor(nullptr), + m_oldRoleEditor(nullptr) { } @@ -770,7 +770,7 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const } m_oldRoleEditor = m_roleEditor; m_roleEditor->hide(); - m_roleEditor = 0; + m_roleEditor = nullptr; } return; } @@ -852,13 +852,21 @@ void KStandardItemListWidget::hideEvent(QHideEvent* event) bool KStandardItemListWidget::event(QEvent *event) { - if (event->type() == QEvent::WindowDeactivate || event->type() == QEvent::WindowActivate) { + if (event->type() == QEvent::WindowDeactivate || event->type() == QEvent::WindowActivate + || event->type() == QEvent::PaletteChange) { m_dirtyContent = true; } return KItemListWidget::event(event); } +void KStandardItemListWidget::finishRoleEditing() +{ + if (!editedRole().isEmpty() && m_roleEditor) { + slotRoleEditingFinished(editedRole(), KIO::encodeFileName(m_roleEditor->toPlainText())); + } +} + void KStandardItemListWidget::slotCutItemsChanged() { const QUrl itemUrl = data().value("url").toUrl(); @@ -990,7 +998,7 @@ void KStandardItemListWidget::updatePixmapCache() if (!m_overlay.isNull()) { QPainter painter(&m_pixmap); - painter.drawPixmap(0, m_pixmap.height() - m_overlay.height(), m_overlay); + painter.drawPixmap(0, (m_pixmap.height() - m_overlay.height()) / m_pixmap.devicePixelRatio(), m_overlay); } int scaledIconSize = 0; @@ -1089,11 +1097,13 @@ void KStandardItemListWidget::updateTextsCache() if (ratingSize.width() > availableWidth) { ratingSize.rwidth() = availableWidth; } - m_rating = QPixmap(ratingSize.toSize()); + const qreal dpr = qApp->devicePixelRatio(); + m_rating = QPixmap(ratingSize.toSize() * dpr); + m_rating.setDevicePixelRatio(dpr); m_rating.fill(Qt::transparent); QPainter painter(&m_rating); - const QRect rect(0, 0, m_rating.width(), m_rating.height()); + const QRect rect(QPoint(0, 0), ratingSize.toSize()); const int rating = data().value("rating").toInt(); KRatingPainter::paintRating(&painter, rect, Qt::AlignJustify | Qt::AlignVCenter, rating); } else if (!m_rating.isNull()) { @@ -1444,7 +1454,7 @@ void KStandardItemListWidget::closeRoleEditor() } m_oldRoleEditor = m_roleEditor; m_roleEditor->hide(); - m_roleEditor = 0; + m_roleEditor = nullptr; } QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStringList& overlays, int size, QIcon::Mode mode)