Changeset View
Changeset View
Standalone View
Standalone View
krusader/DiskUsage/dulines.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | #include "../compat.h" | 46 | #include "../compat.h" | ||
47 | 47 | | |||
48 | class DULinesItemDelegate : public QItemDelegate | 48 | class DULinesItemDelegate : public QItemDelegate | ||
49 | { | 49 | { | ||
50 | public: | 50 | public: | ||
51 | 51 | | |||
52 | explicit DULinesItemDelegate(QObject *parent = nullptr) : QItemDelegate(parent) {} | 52 | explicit DULinesItemDelegate(QObject *parent = nullptr) : QItemDelegate(parent) {} | ||
53 | 53 | | |||
54 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE { | 54 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { | ||
55 | QItemDelegate::paint(painter, option, index); | 55 | QItemDelegate::paint(painter, option, index); | ||
56 | 56 | | |||
57 | QVariant value = index.data(Qt::UserRole); | 57 | QVariant value = index.data(Qt::UserRole); | ||
58 | if (value.isValid()) { | 58 | if (value.isValid()) { | ||
59 | QString text = value.toString(); | 59 | QString text = value.toString(); | ||
60 | 60 | | |||
61 | value = index.data(Qt::DisplayRole); | 61 | value = index.data(Qt::DisplayRole); | ||
62 | QString display; | 62 | QString display; | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 137 | DULinesItem(DiskUsage *diskUsageIn, File *fileItem, QTreeWidget * parent, QTreeWidgetItem * after, | |||
139 | diskUsage(diskUsageIn), file(fileItem) { | 139 | diskUsage(diskUsageIn), file(fileItem) { | ||
140 | setText(0, label1); | 140 | setText(0, label1); | ||
141 | setText(1, label2); | 141 | setText(1, label2); | ||
142 | setText(2, label3); | 142 | setText(2, label3); | ||
143 | 143 | | |||
144 | setTextAlignment(1, Qt::AlignRight); | 144 | setTextAlignment(1, Qt::AlignRight); | ||
145 | } | 145 | } | ||
146 | 146 | | |||
147 | bool operator<(const QTreeWidgetItem &other) const Q_DECL_OVERRIDE { | 147 | bool operator<(const QTreeWidgetItem &other) const override { | ||
148 | int column = treeWidget() ? treeWidget()->sortColumn() : 0; | 148 | int column = treeWidget() ? treeWidget()->sortColumn() : 0; | ||
149 | 149 | | |||
150 | if (text(0) == "..") | 150 | if (text(0) == "..") | ||
151 | return true; | 151 | return true; | ||
152 | 152 | | |||
153 | const auto *compWith = dynamic_cast< const DULinesItem * >(&other); | 153 | const auto *compWith = dynamic_cast< const DULinesItem * >(&other); | ||
154 | if (compWith == nullptr) | 154 | if (compWith == nullptr) | ||
155 | return false; | 155 | return false; | ||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |