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

Qt Code:
  1. QString htmtext("<table>"
  2. "<tr><td>name1<td>name2....")
To copy to clipboard, switch view to plain text mode 

But I have to work around this to have it work for RTL “Arabic” as follows:

Qt Code:
  1. QString htmtext("<table>"
  2. "<tr><td>name2<td>name1....")
To copy to clipboard, switch view to plain text mode 

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?


here is a sample of the main part that I keep tweaking:

Qt Code:
  1. #include <QTextBrowser>
  2.  
  3. void showtable(int lang)
  4. {
  5. QtextBrowser *textBrowser = new QtextBrowser;
  6. QString report;
  7.  
  8. switch (lang)
  9. {
  10. case 0://Arabic
  11. {
  12. textBrowser->setLayoutDirection(Qt::RightToLeft);// works fine for layout only but not RTL text rendered insude QTextBrowser
  13.  
  14. //-----------table header
  15. report = "<table width=\"100%\" dir=rtl align=right border=1 cellspacing=0 cellpadding=1>" //RTL bug???
  16. "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>"
  17. "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>"
  18. "<td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make nicer
  19. //--------------details
  20. "<tr><td align=right>"+name+"<td align=right><b>"+tr("Name")+"<td rowspan=4 align=center valign=middle>./medialogo.png"
  21. "<tr><td align=right>"+"Qtland"+"<td align=right><b>"+tr("Country")+
  22. "<tr><td align=right>"+"info"+"<td align=right><b>"+tr("Content")+
  23. "<tr><td align=right>"+"programming"+"<td align=right><b>"+tr("Genre")+
  24. "<tr><td align=right>"Owner"<td align=right><b>"+tr("Ownership")+"<td></table><p><br>";
  25. break;
  26. }
  27. case 1://English
  28. {
  29. //-----------table header
  30. report = "<table width=\"100%\" border=1 cellspacing=0 cellpadding=1>" //
  31. "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>"
  32. "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make this nicer
  33. "<td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>"
  34. //--------------details
  35. "<tr><td align=center valign=middle>./medialogo.png<td><b>"+tr("Name")+"<td>"+name+
  36. "<tr><td><b>"+tr("Country")+"<td>"+"Qtland"+
  37. "<tr><td><b>"+tr("Content")+"<td>"+"info"+
  38. "<tr><td><b>"+tr("Genre")+"<td>"+"programming"+
  39. "<tr><td><td><b>"+tr("Ownership")+"<td>"Owner"</table><p><br>";
  40. break;
  41. }
  42. }//switch
  43.  
  44. textBrowser->setText(report);
  45. }
To copy to clipboard, switch view to plain text mode