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 :
#include <QApplication>
#include <QTextEdit>
#include <QTextTableCell>
int main(int argc,char* argv[])
{
list<<"ID";
cellFormat.
setBackground(QColor(Qt
::white));
QVector<QTextLength> constraints;
constraints<<QTextLength
(QTextLength::PercentageLength,
50);
constraints<<QTextLength
(QTextLength::PercentageLength,
50);
textEdit->setReadOnly(true);
boldFormat.
setFontWeight(QFont::Bold);
tableFormat.
setBackground(QColor(Qt
::white));
tableFormat.setAlignment(Qt::AlignHCenter);
tableFormat.setColumnWidthConstraints(constraints);
tableFormat.setCellPadding(40);
cursor.insertText("table below ");
QTextTable* table
=cursor.
insertTable(1,
2,tableFormat
);
for(int j=0;j<1;j++)
{
cell.setFormat(cellFormat);
cursor=cell.firstCursorPosition();
cursor.insertText(list[j],boldFormat);
}
textEdit->show();
return app.exec();
}
#include <QApplication>
#include <QTextEdit>
#include <QTextTableCell>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
QStringList list;
list<<"ID";
QTextCharFormat cellFormat;
cellFormat.setBackground(QColor(Qt::white));
QVector<QTextLength> constraints;
constraints<<QTextLength(QTextLength::PercentageLength,50);
constraints<<QTextLength(QTextLength::PercentageLength,50);
QTextEdit* textEdit=new QTextEdit;
textEdit->setReadOnly(true);
QTextCursor cursor=textEdit->textCursor();
QTextCharFormat boldFormat;
boldFormat.setFontWeight(QFont::Bold);
QTextTableFormat tableFormat;
tableFormat.setBackground(QColor(Qt::white));
tableFormat.setAlignment(Qt::AlignHCenter);
tableFormat.setColumnWidthConstraints(constraints);
tableFormat.setCellPadding(40);
cursor.insertText("table below ");
QTextTable* table=cursor.insertTable(1,2,tableFormat);
for(int j=0;j<1;j++)
{
QTextTableCell cell=table->cellAt(0,j);
cell.setFormat(cellFormat);
cursor=cell.firstCursorPosition();
cursor.insertText(list[j],boldFormat);
}
textEdit->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
i want it to be:
from this :
to this shape :
any ideas ??
Bookmarks