| 320 | } |
| 321 | |
| 322 | QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const |
| 323 | { |
| 324 | QStyleOptionViewItem opt = option; |
| 325 | initStyleOption(&opt, index); |
| 326 | opt.features |= QStyleOptionViewItem::WrapText; |
| 327 | opt.text = index.data().toString(); |
| 328 | opt.textElideMode = Qt::ElideRight; |
| 329 | opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter; |
| 330 | |
| 331 | QStyle* style = opt.widget ? opt.widget->style() : QApplication::style(); |
| 332 | const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, opt.widget) + 1; |
| 333 | int height = 48 + textMargin * 2 + 5; // TODO: turn constants into variables |
| 334 | QSize szz = viewItemTextSize(&opt); |
| 335 | height += szz.height(); |
| 336 | // FIXME: maybe the icon items could scale and keep proportions? |
| 337 | QSize sz(100, height); |
| 338 | return sz; |
| 339 | } |
| 340 | |
| 341 | class NoReturnTextEdit : public QTextEdit { |
| 342 | Q_OBJECT |
no test coverage detected