How to "reset" indent if I remove a QTextList



  • Hello,
    I write at the moment a HTML Editor based on QTextEdit and at the moment I have some problems with a list.
    I create a QTextlist with:

    ui.textEdit->textCursor().createList(QTextListFormat::Style::ListCircle);
    

    I want that only the list format is removed. So that the text looks exactly before I inserted the list.
    I remove the list with:

    ui.textEdit->textCursor().currentList()->remove(ui.textEdit->textCursor().block());
    

    After I did that the list format is correctly removed but the indent is still 1 instead of zero.
    I tried then to manually set the indent to 0 with these functions but it didn't work:

    ui.textEdit->textCursor().blockFormat().setIndent(indent);
    ui.textEdit->textCursor().block().blockFormat().setIndent(indent);
    

    Does anybody has an idea how to correctly change the indent after removing the QTextList.


Log in to reply
 

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