Itemviews and rtl languages
-
have you something like "this":http://developer.qt.nokia.com/faq/answer/how_can_i_align_the_text_and_icons_in_an_itemview
-
There is a Qt::TextAlignmentRole in "enum Qt::ItemDataRole":http://doc.qt.nokia.com/latest/qt.html#ItemDataRole-enum. You can use this to store the alignment in your model or item (depending on wether you use the item views or item widgets)
-
Yes, sure I can specify an alignment. But my impression of the Qt documentation is that these things should be handled automatically. The linedit certainly knows without me telling it. Why doesn't the table itself? Or the QPainter::drawText()? Run the Qt address book demo and start adding some entries. Do you not expect Arabic to be right aligned when later browsing the entries? Or edit a cell in the frozen column demo with some Hebrew. When you hit enter shouldn't the cell also display the text right aligned like the editor did?
From http://doc.qt.nokia.com/4.7/internationalization.html (my emphasis):
QPainter::drawText(int x, int y, const QString &str) will always draw the string with its left edge at the position specified with the x, y parameters. This will usually give you left aligned strings. Arabic and Hebrew application strings are usually right aligned, so for these languages use the version of drawText() that takes a QRect since this will align in accordance with the language.
-
xsacha: The same as two line edits do, one with english the other with arabic text? If you have a item with both arabic and english text then it should do what a lineedit does with the same text.
How to mix left-to-right and right-to-left languages is well defined in the unicode standard.
-
Tobias: Are you saying there is a bug here or is there something that can be done in the code to improve things?
To further underline the inconsistency I have a save as html and print function for my table view also. These both use a QTextDocument with a QTextTable and here the alignment works as expected, i.e. Arabic is rtl in the table cells without me having to do anything special in code.
-
looks like a bug
-
great that the related KDE bug found. (It's always harder to find such bugs due to less users care of that features)
-
phedlund, great!