PDA

View Full Version : QComboBox, RightToLeft layout direction, brackets - incorrect behaviour



napajejenunedk0
3rd May 2011, 17:46
#include <QtGui/QApplication>
#include <QComboBox>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QComboBox cb;
cb.setLayoutDirection( Qt::RightToLeft );
cb.addItem( "Abc" );
cb.addItem( "Abc (Abc)" );
cb.addItem( "(Abc)" );
cb.addItem( "(Abc) Abc" );
cb.addItem( "()" );
cb.addItem( "a (a) a" );
cb.show();

return a.exec();
}

Create an empty Qt Gui application project and run the code above.
Note that if the braces are positioned in ends of the text (in a combobox item) the braces are somehow messed up.

Is this a QComboBox bug?

Searched the forum for a similar problem but found nothing.

high_flyer
4th May 2011, 08:49
its not a combobox bug, but a missusage of the feature.
You are using a left to right alphabet, which orders the symbols from left to right, but you are using a right to left ordering widget for displaying that text.
If you would use Hebrew or Arabic you would have a the brackets in the right order.
You probably what alignment, not text direction.