QTextBlockFormat setIndex(int indentation) bug ?

  • I'm trying to set the indent on a QTextBlock in QPlainTextEdit but the QTextBlockFormat method setIndex doesn't work. The code is

    @ QTextCursor indentCursor(currentBlock);
    QTextBlockFormat tbf=indentCursor.blockFormat();
    // tbf.setBackground(QBrush("Red")); // debug

    The commented out line is simply to verify that the procedure works (it does, the blocks background turns a nice red). I've tried the procedure with various values of indent and have changed the document's default value from 40 to 400 in an effort to see if something works but nothing affects the text blocks indentation.

    Searching Google I found that this problem has been seen previously ("http://www.qtcentre.org/threads/33582-indent-selection-in-QPlainTextEdit":http://www.qtcentre.org/threads/33582-indent-selection-in-QPlainTextEdit) but no effective solution seems to have been found.

    Hopefully I'm just missing something obvious and would appreciate any comments or pointers that will help resolve this problem.

  • Lifetime Qt Champion


    QPlainTextEdit doesn't support as much text formatting as QTextEdit. You should ask this question on the interest mailing to know whether indentation should be.

    Currently, it's not (as in not implemented)

Log in to reply

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