mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
- little improvement in download list delegate
- Disabled editor in finished list
This commit is contained in:
parent
b0f3cdad5d
commit
9b08b0ff8c
@ -104,15 +104,6 @@ class DLListDelegate: public QItemDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
|
||||||
QVariant value = index.data(Qt::FontRole);
|
|
||||||
QFont fnt = value.isValid() ? qvariant_cast<QFont>(value) : option.font;
|
|
||||||
QFontMetrics fontMetrics(fnt);
|
|
||||||
const QString text = index.data(Qt::DisplayRole).toString();
|
|
||||||
QRect textRect = QRect(0, 0, 0, fontMetrics.lineSpacing() * (text.count(QLatin1Char('\n')) + 1));
|
|
||||||
return textRect.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||||
// No editor here
|
// No editor here
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -133,6 +133,11 @@ class FinishedListDelegate: public QItemDelegate {
|
|||||||
return textRect.size();
|
return textRect.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||||
|
// No editor here
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user