Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.4.1, 6.8.0
-
None
Description
Repo steps:
1. Create a combo box whose elements in the drop down list mix RTL text and LTR text (I inserted English letters in between Arabic or Hebrew words)
2. Set the layout direction to RightToLeft
Expected Behaviour:
All text in both the drop down list and the main selection follows RTL layout direction
Actual Behaviour:
The text in the drop down list behaves as expected; the text in the main entry is laid out LeftToRight.
For example, if in c++ I add an entry to a combo box with a string of the form
"A " + "[some arabic text 1]" + " B " + "[some arabic text 2]" + " C"
I would expect, since the layout direction is RightToLeft, to see in the combo box:
"C " + "[some arabic text 2]" + " B " + ""[some arabic text 1]" + " A"
The above is how it is laid out in the drop down list. However, in the main selection, the text appears as I entered it, without it being laid out RightToLeft:
"A " + "[some arabic text 1]" + " B " + "[some arabic text 2]" + " C"
For this example, see "Arabic RTL 8" or "Hebrew RTL 8"; notice how the last entry in the drop down box is different from the main selection, even though they are the same string.
This also happens regardless of whether the RTL or LTR text starts; see "Arabic RTL 5" where the string is
"[some arabic text 1]" + " A " + "[some arabic text 2]"
And in the drop down list, it was correctly displayed as
"[some arabic text 2]" + " A " + "[some arabic text 1]"
But when in the main selection area it displayed as
"[some arabic text 1]" + " A " + "[some arabic text 2]"
Note that if there is no mixing of English and Arabic characters (or any other RTL and LTR text) the behaviour works as expected. See "Arabic RTL 1" for an all RTL example (where both the drop down and main selection match) and "French RTL 1" for an all LTR text example with the layout direction still being RightToLeft; note again that the drop down and main selection match.
Code update:
I just created a new project and only inserted a QComboBox named comboBox. Then I added these lines in the MainWindow::MainWindow function after ui->setupUi(this);
setLayoutDirection(Qt::RightToLeft);
ui->comboBox->addItem(QString(" في ") + QString(" لطيف "));
ui->comboBox->addItem(QString("A ") + QString(" في ") + QString(" لطيف "));
ui->comboBox->addItem(QString("في") + QString(" A ") + QString("لطيف"));
ui->comboBox->addItem(QString(" في ") + QString(" لطيف ") + QString(" A"));
ui->comboBox->addItem(QString("A ") + QString("في") + QString(" B ") + QString("لطيف"));
ui->comboBox->addItem(QString(" في ") + QString(" A ") + QString("لطيف") + QString(" B"));
ui->comboBox->addItem(QString("A ") + QString("في") + QString(" لطيف ") + QString(" B"));
ui->comboBox->addItem(QString("A ") + QString("في") + QString(" B ") + QString("لطيف") + QString(" C"));
See "Update Arabic RTL" for an image of what the result was.