diff --git a/src/dfm-base/utils/elidetextlayout.cpp b/src/dfm-base/utils/elidetextlayout.cpp index 7b868df179..2d7429f063 100644 --- a/src/dfm-base/utils/elidetextlayout.cpp +++ b/src/dfm-base/utils/elidetextlayout.cpp @@ -64,7 +64,6 @@ QList ElideTextLayout::layout(const QRectF &rect, Qt::TextElideMode elid QString curText = text(); auto processLine = [this, &ret, painter, &lastLineRect, background, textLineHeight, &curText, textLines](QTextLine &line) { QRectF lRect = line.naturalTextRect(); - lRect.setTop(lRect.top() - (textLineHeight - line.height())); lRect.setHeight(textLineHeight); ret.append(lRect); @@ -91,7 +90,7 @@ QList ElideTextLayout::layout(const QRectF &rect, Qt::TextElideMode elid while (line.isValid()) { curHeight += textLineHeight; line.setLineWidth(size.width()); - line.setPosition(offset + QPointF(0, textLineHeight - line.height())); + line.setPosition(offset); // check next line is out or not. if (curHeight + textLineHeight > size.height()) { diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/views/expandedItem.cpp b/src/plugins/filemanager/core/dfmplugin-workspace/views/expandedItem.cpp index aea0eb4b1b..75c296d922 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/views/expandedItem.cpp +++ b/src/plugins/filemanager/core/dfmplugin-workspace/views/expandedItem.cpp @@ -65,7 +65,7 @@ void ExpandedItem::paintEvent(QPaintEvent *) QString str = delegate->displayFileName(index); QScopedPointer layout(ItemDelegateHelper::createTextLayout(str, QTextOption::WrapAtWordBoundaryOrAnywhere, - pa.fontMetrics().lineSpacing(), Qt::AlignCenter, &pa)); + pa.fontMetrics().height(), Qt::AlignCenter, &pa)); layout->setAttribute(ElideTextLayout::kBackgroundRadius, kIconModeRectRadius); const FileInfoPointer &info = delegate->parent()->parent()->model()->fileInfo(index); diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/views/iconitemdelegate.cpp b/src/plugins/filemanager/core/dfmplugin-workspace/views/iconitemdelegate.cpp index 3e69a0bc42..04380e7eab 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/views/iconitemdelegate.cpp +++ b/src/plugins/filemanager/core/dfmplugin-workspace/views/iconitemdelegate.cpp @@ -226,7 +226,7 @@ QList IconItemDelegate::paintGeomertys(const QStyleOptionViewItem &option void IconItemDelegate::updateItemSizeHint() { Q_D(IconItemDelegate); - d->textLineHeight = parent()->parent()->fontMetrics().lineSpacing(); + d->textLineHeight = parent()->parent()->fontMetrics().height(); int width = parent()->parent()->iconSize().width() + 30; #ifdef DTKWIDGET_CLASS_DSizeMode diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/views/listitemdelegate.cpp b/src/plugins/filemanager/core/dfmplugin-workspace/views/listitemdelegate.cpp index 43f1f42e95..16d1423cca 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/views/listitemdelegate.cpp +++ b/src/plugins/filemanager/core/dfmplugin-workspace/views/listitemdelegate.cpp @@ -320,7 +320,7 @@ void ListItemDelegate::updateItemSizeHint() { Q_D(ListItemDelegate); - d->textLineHeight = parent()->parent()->fontMetrics().lineSpacing(); + d->textLineHeight = parent()->parent()->fontMetrics().height(); d->itemSizeHint = QSize(-1, qMax(int(parent()->parent()->iconSize().height() * 1.33), d->textLineHeight)); }