Stefan Schimanski wrote:
I tried the patch now and it looks good. The RTL issues I will leave to Dov to judge.

In fact I wonder whether it also fixes my other crash with Qt 4.4 on Mac which I reported some time ago. At least in my little testing I was not able to make it crash again.

Stefan


OK, here's what I think should be removed for RTL. This is to be applied *after* Bernhard's patch. Feel free to apply them together, if you want.

Dov
diff -r a839cad6131a src/frontends/qt4/GuiCompleter.cpp
--- a/src/frontends/qt4/GuiCompleter.cpp        Mon Jun 02 20:28:55 2008 +0300
+++ b/src/frontends/qt4/GuiCompleter.cpp        Mon Jun 02 21:07:28 2008 +0300
@@ -47,31 +47,18 @@
 {
 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 @@
                drawFocus(painter, opt, option.rect);
                painter->restore();
        }
-
-private:
-       bool enabled_;
 };
 
 class GuiCompletionModel : public QAbstractListModel
@@ -474,19 +458,16 @@
        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);
diff -r a839cad6131a src/rowpainter.cpp
--- a/src/rowpainter.cpp        Mon Jun 02 20:28:55 2008 +0300
+++ b/src/rowpainter.cpp        Mon Jun 02 21:07:28 2008 +0300
@@ -838,8 +838,6 @@
        // right to left?
        if (rtl) {
                swap(s1, s2);
-               reverse(s1.begin(), s1.end());
-               reverse(s2.begin(), s2.end());
                swap(c1, c2);
        }
 

Reply via email to