diff --git a/frontend/view/result-view-delegate.cpp b/frontend/view/result-view-delegate.cpp index dd4f7b5..bc10915 100644 --- a/frontend/view/result-view-delegate.cpp +++ b/frontend/view/result-view-delegate.cpp @@ -44,7 +44,8 @@ void ResultViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op { QStyleOptionViewItem opt = option; initStyleOption(&opt, index); - opt.displayAlignment = Qt::Alignment(Qt::AlignLeft|Qt::AlignVCenter); + opt.displayAlignment = QApplication::isLeftToRight() ? + Qt::Alignment(Qt::AlignLeft|Qt::AlignVCenter) : Qt::Alignment(Qt::AlignRight|Qt::AlignVCenter); QString originalText = opt.text; opt.text = QString(); @@ -87,7 +88,8 @@ void ResultViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op m_hightLightEffectHelper->setDocument(m_textDoc); m_hightLightEffectHelper->rehighlight(); - painter->translate(textRect.x(), textRect.y() + (textRect.height() - fontMetrics.height()) / 2 - m_textDoc->documentMargin()); + int textRectX = QApplication::isLeftToRight() ? textRect.x() : textRect.width() - fontMetrics.horizontalAdvance(text) - m_textDoc->documentMargin(); + painter->translate(textRectX, textRect.y() + (textRect.height() - fontMetrics.height()) / 2 - m_textDoc->documentMargin()); m_textDoc->drawContents(painter); painter->restore(); }