Results 1 to 2 of 2

Thread: how can i make QTextTable frame color be white ?

  1. #1
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default how can i make QTextTable frame color be white ?

    hi every one

    how can i make the QTextTable frame in QTextEdit be white so that i won't appear at printing ?

    i tried this one but it still shown :

    Qt Code:
    1. #include <QApplication>
    2. #include <QTextEdit>
    3. #include <QTextTableCell>
    4.  
    5.  
    6.  
    7. int main(int argc,char* argv[])
    8. {
    9. QApplication app(argc,argv);
    10.  
    11. list<<"ID";
    12.  
    13. QTextCharFormat cellFormat;
    14. cellFormat.setBackground(QColor(Qt::white));
    15.  
    16. QVector<QTextLength> constraints;
    17. constraints<<QTextLength(QTextLength::PercentageLength,50);
    18. constraints<<QTextLength(QTextLength::PercentageLength,50);
    19.  
    20.  
    21.  
    22. QTextEdit* textEdit=new QTextEdit;
    23. textEdit->setReadOnly(true);
    24.  
    25. QTextCursor cursor=textEdit->textCursor();
    26.  
    27. QTextCharFormat boldFormat;
    28. boldFormat.setFontWeight(QFont::Bold);
    29.  
    30. QTextTableFormat tableFormat;
    31. tableFormat.setBackground(QColor(Qt::white));
    32. tableFormat.setAlignment(Qt::AlignHCenter);
    33. tableFormat.setColumnWidthConstraints(constraints);
    34. tableFormat.setCellPadding(40);
    35.  
    36.  
    37.  
    38. cursor.insertText("table below ");
    39. QTextTable* table=cursor.insertTable(1,2,tableFormat);
    40.  
    41.  
    42. for(int j=0;j<1;j++)
    43. {
    44. QTextTableCell cell=table->cellAt(0,j);
    45. cell.setFormat(cellFormat);
    46. cursor=cell.firstCursorPosition();
    47. cursor.insertText(list[j],boldFormat);
    48. }
    49.  
    50.  
    51.  
    52. textEdit->show();
    53. return app.exec();
    54. }
    To copy to clipboard, switch view to plain text mode 

    i want it to be:

    from this :


    to this shape :


    any ideas ??

  2. #2
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how can i make QTextTable frame color be white ?

    Problem solved!

    i added this line after its declare :

    Qt Code:
    1. tableFormat.setBorder(0);
    To copy to clipboard, switch view to plain text mode 

    and .... Done!

Similar Threads

  1. QSS, trying to make the text on the combo box WHITE not black.
    By technoViking in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2010, 23:57
  2. Change frame background color
    By Ishmael in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 05:38
  3. Change Color of Focus Frame
    By crybaby in forum Newbie
    Replies: 3
    Last Post: 30th October 2009, 07:02
  4. QTextTable background color?
    By anupamgee in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2009, 10:40
  5. how to change the color of the frame
    By wagmare in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2009, 12:46

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.