Menu

#2 LayoutDirection bug

2.0
closed
nobody
2014-10-05
2014-08-16
mbnoimi
No

QtRprtDesigner doesn't appear correctly for RightToLeft layout direction's although I put the following snippet in main.cpp:

if (QLocale::system().language() == QLocale::Arabic) {
        if (qTranslator.load(":/language/i18n/QtRprtDesigner_ar.qm")) {
            a.installTranslator(&qTranslator);
            //FIXME: Doesn't apply LayoutDirection !!!
            a.setLayoutDirection(Qt::RightToLeft);
        }
    }

IMPORTANT NOTE: This but doesn't exist in earlier versions of QtRprtDesigner

Discussion

  • aliks-os

    aliks-os - 2014-08-17

    It is very difficult to define it for me in what a mistake. As never I worked with the Arabic language, and I can't see that something is wrong. If you can correct an error - please make it. Or show a screenshot in more detail explaining in what problem.

     
  • mbnoimi

    mbnoimi - 2014-09-22
    • When run the app for first time it loads Arabic language automatically but the layout direction appears in LeftToRight
    • When I set the Arabic language from setting it appears in LeftToRight
    • When I set the English language from setting it appears in RightToLeft!
     
  • aliks-os

    aliks-os - 2014-09-23

    Take a look at the attached screenshoot. You mean RightToLeft like that ?

     
  • mbnoimi

    mbnoimi - 2014-09-23

    Yes exactly but as you notice the rulers appears incorrect!

    As shown in the attached sccreenshot you can see how QtRPT Designer appears in case I set the language is Arabic from its settings!

     
    • aliks-os

      aliks-os - 2014-09-24

      In 1.4.2, if you set Arabic language will be OK. But rulers yes, incorrect, I will correct it in future versions.

       
  • aliks-os

    aliks-os - 2014-09-25

    Hor.rule corrected for RightToLeft direction. You may check SVN

     
  • mbnoimi

    mbnoimi - 2014-10-01

    Thank you aliks-os it works fine but TEXT FIELD and the other components still missing RTL support.

    See the difference between the incorrect files and the correct one.

     
    • aliks-os

      aliks-os - 2014-10-02

      According some messages from forum...for example http://qt-project.org/forums/viewthread/12459.

      The direction in QTextEdit automatic sets depends of the language. In your example you mix Arabic and Latin characters. So Qt here can not correct set the direction for all field. My opinion the best way is use aligment to the right

       
  • mbnoimi

    mbnoimi - 2014-10-02

    The automatic direction of QTextEdit applies partially (depending on first character as shown in incorrect_QtRPT_fieldEditor.jpg) on input text only so it doesn't store the style.

    To fix this issue I suggest to add a toolButton in each input text (similar to Qt solution as shown in correct_QtDesigner_5.3.1.jpg) for saving the style of HTML of QTextEdit thus you can store the direction depending on user's demand (currently you're storing plain text)

     
    • aliks-os

      aliks-os - 2014-10-02

      It is a not a way...in qtrpt the value of the fields proccessing as a plain text - not as HTML

       
  • mbnoimi

    mbnoimi - 2014-10-02

    I tried to store HTML data inside text field but unfortunately the report couldn't parse it :(

    Plain text

    [subtitle]
    Phone: [phone] - Fax: [fax]
    [address]
    ~~~~~~~~~~~~
    
    HTML data
    
    <html><head><meta name="qrichtext" content="1"/><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">

    [subtitle]

    هاتف: [phone] - فاكس: [fax]

    [address]

    </body></html> ~~~~~~~~~~~~~
     
    • aliks-os

      aliks-os - 2014-10-05

      the field is not supports the HTML data

       
  • mbnoimi

    mbnoimi - 2014-10-02

    I edit the above text using QtDesigner 5.3.1

     
  • mbnoimi

    mbnoimi - 2014-10-05

    In case fields doesn't support HTML how QtRPT will support Arabic? Without fixing this issue QtRPT will be worthless for Arabic users :(

    Any way, you can fix this issue without HTML/RichText format by adding RTL mark to the plain text but you've to add a button for it.

    BTW: Qt fully supports Arabic while QtRPT not!

    More about RTL mark:
    http://en.wikipedia.org/wiki/Right-to-left_mark

     
    • aliks-os

      aliks-os - 2014-10-05

      Well but you try to mix latin and arabic characters.
      As I wrote to you before, you should to use in this case right aligment.

       
  • aliks-os

    aliks-os - 2014-10-05
    • status: open --> closed
     

Log in to post a comment.