diff options
Diffstat (limited to 'mingui')
-rw-r--r-- | mingui/imageitem.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mingui/imageitem.cpp b/mingui/imageitem.cpp index ec7dc94..470a2f2 100644 --- a/mingui/imageitem.cpp +++ b/mingui/imageitem.cpp @@ -77,20 +77,16 @@ void ImageItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt .arg(dim.width()).arg(dim.height()) .arg(QLocale::system().formattedDataSize(fsz, 3)); QString fns = index.data(Qt::ItemDataRole::DisplayRole).toString(); + QTextOption topt; + topt.setWrapMode(QTextOption::WrapMode::NoWrap); r = option.fontMetrics.boundingRect(infos); r.moveTopLeft(ftopright + QPoint(0, (hkbg.height() - r.height()) / 2)); painter->setFont(option.font); painter->setPen(option.widget->palette().color(QPalette::ColorGroup::Normal, QPalette::ColorRole::Text)); - painter->drawText(r, infos); + painter->drawText(r, infos, topt); r = option.fontMetrics.boundingRect(fns); r.moveTopRight(QPoint(option.rect.right() - MARGIN - BORDER, ftopright.y() + (hkbg.height() - r.height()) / 2)); - painter->drawText(r, fns); - /* - painter->setPen(QColor(Qt::GlobalColor::red)); - painter->drawRect(QRect(imr.topLeft(), imd)); - painter->drawRect(txt); - painter->setPen(option.widget->palette().color(QPalette::ColorRole::Text)); - */ + painter->drawText(r, fns, topt); } QSize ImageItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const |