From: Dov Feldstern Date: Wed, 4 Jun 2008 19:45:26 +0000 (+0000) Subject: fix completion painting for RTL (inline completion and completion list) X-Git-Tag: 1.6.10~4521 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=dba608e1d7ce6220bc20470899927a461ee2394c;p=features.git fix completion painting for RTL (inline completion and completion list) see http://permalink.gmane.org/gmane.editors.lyx.devel/107923 for an explanation, though note that this patch is more extensive than the one attached there git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25118 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiCompleter.cpp b/src/frontends/qt4/GuiCompleter.cpp index 386f019575..4b592dcad7 100644 --- a/src/frontends/qt4/GuiCompleter.cpp +++ b/src/frontends/qt4/GuiCompleter.cpp @@ -47,31 +47,18 @@ class CompleterItemDelegate : public QItemDelegate { public: explicit CompleterItemDelegate(QObject * parent) - : QItemDelegate(parent), enabled_(false) + : QItemDelegate(parent) {} ~CompleterItemDelegate() {} - void setEnabled(bool enabled = true) - { - enabled_ = enabled; - } - protected: void drawDisplay(QPainter * painter, QStyleOptionViewItem const & option, QRect const & rect, QString const & text) const { - if (!enabled_) { - QItemDelegate::drawDisplay(painter, option, rect, text); - return; - } - - // FIXME: do this more elegantly - docstring stltext = qstring_to_ucs4(text); - reverse(stltext.begin(), stltext.end()); - QItemDelegate::drawDisplay(painter, option, rect, toqstr(stltext)); + QItemDelegate::drawDisplay(painter, option, rect, text); } void paint(QPainter *painter, const QStyleOptionViewItem &option, @@ -97,9 +84,6 @@ protected: drawFocus(painter, opt, option.rect); painter->restore(); } - -private: - bool enabled_; }; class GuiCompletionModel : public QAbstractListModel @@ -474,20 +458,17 @@ void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate if (old.length() == 0) old = last_selection_; + // set whether rtl bool rtl = false; if (cur.inTexted()) { Paragraph const & par = cur.paragraph(); Font const font = - par.getFontSettings(cur.bv().buffer().params(), cur.pos()); + par.getFontSettings(cur.bv().buffer().params(), cur.pos()); rtl = font.isVisibleRightToLeft(); } popup()->setLayoutDirection(rtl ? Qt::RightToLeft : Qt::LeftToRight); - // turn the direction of the strings in the popup. - // Qt does not do that itself. - itemDelegate_->setEnabled(rtl); - // set new model CompletionList const * list = cur.inset().createCompletionList(cur); model_->setList(list); diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 6cf341016d..8ef3b6f310 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -838,8 +838,6 @@ void RowPainter::paintInlineCompletion(Font const & font) // right to left? if (rtl) { swap(s1, s2); - reverse(s1.begin(), s1.end()); - reverse(s2.begin(), s2.end()); swap(c1, c2); }