[SOLVED]QTextDocument, table and table border width 1px.



  • Hello.

    I'm create table by two ways:
    QTextCursor::insertTable
    @QTextTableFormat tableFormat;
    tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Solid);
    tableFormat.setCellPadding(1);
    tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 40));
    tableFormat.setAlignment(Qt::AlignLeft);
    m_cursor->insertTable(4, 2, tableFormat);@
    and with HTML
    @QString tableStr;
    tableStr.append("<table align="center" border="1">");
    //...
    m_cursor.insertHtml(tableStr);@

    And the table have a "3D" border. How I can set thin border.

    Many thanks.



  • For the first one:
    @tableFormat.setBorderMargin(1)@
    And for the second one:
    @tableStr.append("<table align="center" "style"="border: solid 1px;">")@
    remove the " around style, it wouldn't show up in the post without it.
    Hope that helps.



  • thanks for reply.

    @tableFormat.setBorderMargin(1);@ - there is no setBorderMardin method in the QTextTableFormat :( There is setMargin(qreal) method, but it has no effect :(
    I found tableFormat.setCellSpacing(0), which make border more thin.

    "And for the second one: "
    I set "<table "style"="border:solid 1px;">" but, I can't see any border :(.

    Can anybody talk me, how to make table with QTextCursor::insertTable if table is a difficult (have a cells with a "rowspan" and "colspan")?

    I found @QTextTable::mergeCells(int row, int col, int rowspan, int colspan);@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.