Results 1 to 2 of 2

Thread: QComboBox, RightToLeft layout direction, brackets - incorrect behaviour

  1. #1
    Join Date
    Apr 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QComboBox, RightToLeft layout direction, brackets - incorrect behaviour

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QComboBox>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7.  
    8. cb.setLayoutDirection( Qt::RightToLeft );
    9. cb.addItem( "Abc" );
    10. cb.addItem( "Abc (Abc)" );
    11. cb.addItem( "(Abc)" );
    12. cb.addItem( "(Abc) Abc" );
    13. cb.addItem( "()" );
    14. cb.addItem( "a (a) a" );
    15. cb.show();
    16.  
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox, RightToLeft layout direction, brackets - incorrect behaviour

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. DockWidgetArea change and layout direction change
    By mstegehu in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2012, 21:24
  2. Replies: 3
    Last Post: 28th December 2010, 11:55
  3. layout direction issues with QGraphicsScene
    By sanjayshelke in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2009, 23:23
  4. QComboBox -> setModel -> Strange behaviour
    By oscar in forum Qt Programming
    Replies: 2
    Last Post: 13th August 2008, 21:27
  5. RightToLeft QTextEdit for Hebrew
    By hed in forum Qt Programming
    Replies: 6
    Last Post: 16th April 2008, 20:33

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.