mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-25 22:06:16 -04:00
Revert "Custom Elide for Suggestion List Text"
This reverts commit 8246c5c2c5d35deaf7265a225f98ec769638a42a.
This commit is contained in:
parent
8246c5c2c5
commit
f5dac7fa3f
@ -68,23 +68,5 @@ void SuggestionListDelegate::paintText(QPainter *p,
|
||||
|
||||
const int flag = {Qt::AlignVCenter | Qt::AlignLeading};
|
||||
const QString text = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
/* Custom text elide. */
|
||||
const QFontMetrics metrics = opt.fontMetrics;
|
||||
const int elideMarkerLength = metrics.tightBoundingRect("(...)").width();
|
||||
const int textLength = textRect.width() - elideMarkerLength;
|
||||
QString elidedText = metrics.elidedText(text, Qt::ElideRight, textLength);
|
||||
if (elidedText != text)
|
||||
{
|
||||
/* Remove built-in elide marker */
|
||||
elidedText.chop(1);
|
||||
|
||||
/* drawText's Align direction determines text direction */
|
||||
const bool textDirFlipped = KiwixApp::isRightToLeft() != text.isRightToLeft();
|
||||
elidedText = textDirFlipped ? "(...)" + elidedText.trimmed()
|
||||
: elidedText.trimmed() + "(...)";
|
||||
p->drawText(textRect, flag, elidedText);
|
||||
}
|
||||
else
|
||||
p->drawText(textRect, flag, text);
|
||||
p->drawText(textRect, flag, text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user