#include <QPainter>
#include <QTimer>
+ #include <QGraphicsScene>
+ #include <QGraphicsView>
// #define KFILEITEMLISTVIEW_DEBUG
// If the icon size changes, a longer delay is used. This prevents that
// the expensive re-generation of all previews is triggered repeatedly when
- // chaning the zoom level.
+ // changing the zoom level.
const int LongInterval = 300;
}
yCount = xCount;
}
+ const qreal dpr = scene()->views()[0]->devicePixelRatio();
// Draw the selected items into the grid cells.
- QPixmap dragPixmap(xCount * size + xCount, yCount * size + yCount);
+ QPixmap dragPixmap(QSize(xCount * size + xCount, yCount * size + yCount) * dpr);
+ dragPixmap.setDevicePixelRatio(dpr);
dragPixmap.fill(Qt::transparent);
QPainter painter(&dragPixmap);
QIcon icon = QIcon::fromTheme(model()->data(index).value("iconName").toString());
pixmap = icon.pixmap(size, size);
} else {
- KPixmapModifier::scale(pixmap, QSize(size, size));
+ KPixmapModifier::scale(pixmap, QSize(size, size) * dpr);
}
painter.drawPixmap(x, y, pixmap);