diff options
author | Chris Xiong <chirs241097@gmail.com> | 2022-09-12 10:25:37 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2022-09-12 10:25:37 -0400 |
commit | dbd44af7c6452f630a664df0b00b2d17bdef2f06 (patch) | |
tree | 145bbd2c40923de6571c9ac79d0e54c39253ae1d /mingui | |
parent | 12d21666e8352eb71ac355bdfbf2b401ba852e13 (diff) | |
download | deduper-dbd44af7c6452f630a664df0b00b2d17bdef2f06.tar.xz |
disable text wrap in image items.
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 |