Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTextBlockFormat setIndex(int indentation) bug ?
Pt_develop last edited by
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);
// 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.
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)