- little improvement in download list delegate

- Disabled editor in finished list
This commit is contained in:
Christophe Dumez 2007-07-31 10:42:45 +00:00
parent b0f3cdad5d
commit 9b08b0ff8c
2 changed files with 5 additions and 9 deletions

View File

@ -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;

View File

@ -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