| 348 | } |
| 349 | |
| 350 | QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option, |
| 351 | const QModelIndex &index) const |
| 352 | { |
| 353 | QStyleOptionViewItem opt = option; |
| 354 | initStyleOption(&opt, index); |
| 355 | opt.features |= QStyleOptionViewItem::WrapText; |
| 356 | opt.text = index.data().toString(); |
| 357 | opt.textElideMode = Qt::ElideRight; |
| 358 | opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter; |
| 359 | |
| 360 | QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); |
| 361 | const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, opt.widget) + 1; |
| 362 | int height = 48 + textMargin * 2 + 5; // TODO: turn constants into variables |
| 363 | QSize szz = viewItemTextSize(&opt); |
| 364 | height += szz.height(); |
| 365 | // FIXME: maybe the icon items could scale and keep proportions? |
| 366 | QSize sz(100, height); |
| 367 | return sz; |
| 368 | } |
| 369 | |
| 370 | class NoReturnTextEdit: public QTextEdit |
| 371 | { |
no test coverage detected