Hello,

I have a text atble i removed the boarders because i want to draw my own.

i want to look like thisAttachment 8478

any one know how to do this.
here is the code if need be
Qt Code:
  1. // editor->setDocumentMargin(25);
  2.  
  3. //creates writing format
  4. QTextCharFormat NormalFormat;
  5. NormalFormat.setFont(QFont("Helvetica",20,QFont::Bold));
  6.  
  7. block.setAlignment(Qt::AlignBottom);
  8.  
  9.  
  10.  
  11. //create pointer to current cursor location
  12. QTextCursor cursor (editor);
  13. cursor.beginEditBlock();
  14.  
  15. cursor.movePosition(QTextCursor::Start);
  16. cursor.setBlockFormat(block);
  17. cursor.insertBlock();
  18. cursor.insertBlock();
  19. cursor.insertBlock();
  20. cursor.insertText(" ",NormalFormat);
  21. cursor.insertText("Escort Data Logger Report",NormalFormat);
  22. cursor.insertBlock();
  23. cursor.insertBlock();
  24. cursor.insertBlock();
  25.  
  26. QTextTableFormat tableFormat;
  27. tableFormat.setBackground(QColor("#ffffff"));
  28. tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Inset);
  29. tableFormat.setBorder(0);
  30. tableFormat.setCellPadding(2);
  31. tableFormat.setCellSpacing(4);
  32.  
  33. tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 100));
  34. QTextTable *tab=cursor.insertTable(tabW->rowCount()+1,tabW->columnCount(),tableFormat);
  35.  
  36.  
  37. QTextFrame *frame=cursor.currentFrame();
  38.  
  39. QTextFrameFormat frameFormat=frame->frameFormat();
  40. cursor.insertFrame(frameFormat);
  41. cursor.setPosition(frame->lastPosition());
  42. frame->setFrameFormat(frameFormat);
  43. QTextCharFormat format_entete_tab;
  44. format_entete_tab.setFontPointSize(15);
  45. format_entete_tab.setFontWeight(QFont::Bold);
  46. QTextCharFormat format_cellule;
  47. format_cellule.setFontPointSize(12);
  48. for(int i=0;i<tabW->columnCount();i++)
  49. {
  50. QTextTableCell titre = tab->cellAt(0,i);// change 0 it moves the title
  51. QTextCursor cellCursor=titre.firstCursorPosition();
  52. cellCursor.insertText(tabW->horizontalHeaderItem(i)->text(),format_entete_tab);
  53. }
  54. QTextCursor cellCursor;
  55. for(int row=1;row<tab->rows();row++)
  56. {
  57. for(int col=0;col<tab->columns();col++)
  58. {
  59. cell=tab->cellAt(row,col);
  60. cellCursor=cell.firstCursorPosition();
  61. cellCursor.insertText(tr("%1").arg(tabW->item(row-1,col)->text()),format_cellule);
  62. }
  63. }
  64. cursor.endEditBlock();
To copy to clipboard, switch view to plain text mode