Nominate our 2022 Qt Champions!

Qt supported html subset, RTL problem

  • Hi

    I am using Qt 4.7.4 Win.
    My problem is that the RTL feature seems not to work for the HTML "table" element.
    e.g. the following works fine for LTR languages

    @QString htmtext("<table>"

    But I have to work around this to have it work for RTL "Arabic" as follows:
    @QString htmtext("<table>"

    Very annoying when working with big table.

    Using dir="rtl" proved to be of no use here too; is it a bug or Qt works this way?

    please help;

  • Maybe it's a bug? Can you paste a minimal testcode? Also, does it happen with webkit?

  • Hi! thanks for the reply
    here is a sample of the main part that I keep tweaking:

    @#include <QTextBrowser>

    void showtable(int lang)
    QtextBrowser *textBrowser = new QtextBrowser;
    QString report;

            switch (lang)
            case 0://Arabic
                setLayoutDirection(Qt::RightToLeft);// works fine for layout only but not RTL text rendered insude QTextBrowser
                //-----------table header
                report = "<table width=\"100%\" dir=rtl align=right border=1 cellspacing=0 cellpadding=1>" //RTL bug???
                          "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>"
                          "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>"
                          "<td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make nicer
                          "<tr><td align=right>"+name+"<td align=right><b>"+tr("Name")+"<td rowspan=4 align=center valign=middle><img src='./medialogo.png'>"
                          "<tr><td align=right>"+"Qtland"+"<td align=right><b>"+tr("Country")+
                          "<tr><td align=right>"+"info"+"<td align=right><b>"+tr("Content")+
                          "<tr><td align=right>"+"programming"+"<td align=right><b>"+tr("Genre")+
                          "<tr><td align=right>"Owner"<td align=right><b>"+tr("Ownership")+"<td></table><p><br>";
            case 1://English
                //-----------table header
                report = "<table width=\"100%\" border=1 cellspacing=0 cellpadding=1>" //
                          "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>"
                          "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make this nicer
                          "<td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>"
                          "<tr><td  align=center valign=middle><img src='./medialogo.png'><td><b>"+tr("Name")+"<td>"+name+


    I didn't test it against Webkit.

    Thanks in advance

Log in to reply