[Qt-interest] Simple QTextTable border dificulty
Israel Brewster
israel at frontierflying.com
Tue Feb 24 18:32:10 CET 2009
No responses? Really? So does that mean it is impossible to fix this
issue? Or is it that I am doing everything right, and simply shouldn't
be getting this issue at all? :-D
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
On Feb 20, 2009, at 3:03 PM, Israel Brewster wrote:
> I am trying to make a table in a QTextDocument that has simple
> single thin black lines between the cells. Unfortunately I am having
> some difficulty accomplishing this - some of the created lines are
> as desired (such as the left border on the 8 cell in the attached
> screen shot), but others (such as the top and right borders on said
> cell) appear doubled. The bottom border is Ok, but does appear
> somewhat heaver than the rest. The code that created this table is
> shown below. How can I fix this? Thanks.
>
>
> QTextDocument *document=new QTextDocument;
> QTextCursor cursor(document), cellCursor;
> QTextFrame *topFrame = cursor.currentFrame();
> QTextTableCellFormat cellFormat;
>
> cellFormat.setLeftPadding(7);
> cellFormat.setRightPadding(7);
>
> QBrush blackBrush(Qt::SolidPattern);
> QTextTableFormat tableFormat;
> tableFormat.setAlignment(Qt::AlignLeft);
> tableFormat.setBorderBrush(blackBrush);
> tableFormat.setBorder(.5); //using .5 because I figure the left
> border of one cell plus the right border of the next should make 1
> tableFormat.setCellSpacing(0); //I want no space between the cells.
> tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Solid);
> tableFormat.setAlignment(Qt::AlignLeft);
>
> QVector<QTextLength> constraints;
> for(int i=0;i<15;i++)
> constraints<< QTextLength(QTextLength::PercentageLength,6.6);
> tableFormat.setColumnWidthConstraints(constraints);
>
> table = cursor.insertTable(1,15,tableFormat);
>
> I then loop through each cell doing something like the following:
>
> cell=table->cellAt(0,0);
> cell.setFormat(cellFormat);
> cellCursor=cell.firstCursorPosition();
> cellCursor.insertText("Day ");
>
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
>
> <badBorders.pdf>_______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list