Dov Feldstern schrieb:
Bernhard Roider wrote:
Hello Stefan,

today i finally found some time to investigate the problem we discussed at the beginning of march concerning the completion list: rtl text does not work and icons are not displayed for math symbols.

Here is a patch that solves that issue for me using qt 4.2.3. There are two things that caused the problem: 1. QCompleter::setModel() changed the item delegates internally, so the specialized ones vanished
2. item delegates for columns are not used --> qt bug?

The attached patch solves both issues so that it works with my qt version. It should be tested for newer versions of qt.

...

bernhard


Hi!

What exactly is the problem with RTL completion that this patch is trying to solve? Can you separate out the part dealing with RTL from the rest of the patch?

Without your patch, I'm seeing (Linux, Qt 4.2.1) RTL completion behave correctly, except for the fact that the inline completion (the grayed out part) is reversed; the list of completions, though, behaves correctly.

With your patch applied, also the strings in the completions list are reversed.

Applying the attached (very complicated ;) ) patch *instead* of yours fixes the problem of the inlined strings, without adversely affecting the completions list.

I believe that what's happening is this: the completions list is presumably getting the strings in "logical" order (the way they're held in memory). When the strings are painted (both in the list and inlined), since they are being painted as an entire string at once (and not one character at a time, as we normally do with RTL text) Qt is applying its own bidi algorithm, and thus the strings are painted correctly, *provided* that the strings are really composed of true RTL characters (Qt does not know about our marking text as RTL, it only knows if text is RTL or not based on the unicode values). You guys were probably testing the RTL capabilities with Latin characters, so Qt was *not* reversing the strings, and thus the strings appeared to you to be painted backwards, which is why you were applying an extra reversal.

Your guess is correct. With my patch the completion list works for qt 4.2 as it does for higher versions, that is
1. display the icons for math symbols
2. reverse the strings in the list if they are rtl.


I'm not sure whether locale settings affect this or not, but I think that they don't, as long as there is a *legal* locale setting.

In summary, I think that the reversals should be removed, as in the attached patch. If most of Bernhard's patch is still relevant for non-RTL issues, then the RTL-specific issues should be removed from it, as well.

Stefan, will you take a look at this?

Bernhard


To be sure, this solution isn't perfect, because we're being inconsistent by letting Qt do some of the bidi work, and doing some of it ourselves; and this becomes visible precisely in the pathological cases where there's a difference between us and Qt, such as Latin text which we mark as RTL; but for normal RTL usage, I believe the reversals should *not* be done.

Dov


Reply via email to