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