#include "kfileitemlistview.h"
-#include "kfileitemmodelrolesupdater.h"
#include "kfileitemlistwidget.h"
#include "kfileitemmodel.h"
+#include "kfileitemmodelrolesupdater.h"
#include "private/kpixmapmodifier.h"
-#include <QIcon>
#include <KIconLoader>
-#include <QPainter>
-#include <QTimer>
#include <QGraphicsScene>
#include <QGraphicsView>
+#include <QPainter>
+#include <QTimer>
// #define KFILEITEMLISTVIEW_DEBUG
namespace {
// If the visible index range changes, KFileItemModelRolesUpdater is not
- // informed immediatetly, but with a short delay. This ensures that scrolling
+ // informed immediately, but with a short delay. This ensures that scrolling
// always feels smooth and is not interrupted by icon loading (which can be
// quite expensive if a disk access is required to determine the final icon).
const int ShortInterval = 50;
// 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;
}
KFileItemListView::KFileItemListView(QGraphicsWidget* parent) :
KStandardItemListView(parent),
- m_modelRolesUpdater(0),
- m_updateVisibleIndexRangeTimer(0),
- m_updateIconSizeTimer(0)
+ m_modelRolesUpdater(nullptr),
+ m_updateVisibleIndexRangeTimer(nullptr),
+ m_updateIconSizeTimer(nullptr)
{
setAcceptDrops(true);
yCount = xCount;
}
- qreal dpr = scene()->views()[0]->devicePixelRatio();
+ const qreal dpr = scene()->views()[0]->devicePixelRatio();
// Draw the selected items into the grid cells.
- QPixmap dragPixmap(QSize(xCount * size + xCount, yCount * size + yCount)*dpr);
+ QPixmap dragPixmap(QSize(xCount * size + xCount, yCount * size + yCount) * dpr);
dragPixmap.setDevicePixelRatio(dpr);
dragPixmap.fill(Qt::transparent);
int x = 0;
int y = 0;
- foreach (int index, indexes) {
+ for (int index : indexes) {
QPixmap pixmap = model()->data(index).value("iconPixmap").value<QPixmap>();
if (pixmap.isNull()) {
QIcon icon = QIcon::fromTheme(model()->data(index).value("iconName").toString());
KStandardItemListView::onModelChanged(current, previous);
delete m_modelRolesUpdater;
- m_modelRolesUpdater = 0;
+ m_modelRolesUpdater = nullptr;
if (current) {
m_modelRolesUpdater = new KFileItemModelRolesUpdater(static_cast<KFileItemModel*>(current), this);
roles.insert("text");
roles.insert("isDir");
roles.insert("isLink");
+ roles.insert("isHidden");
if (supportsItemExpanding()) {
roles.insert("isExpanded");
roles.insert("isExpandable");