QTextCursor beginEditBlock bug?
Pt_develop last edited by
I've run into a problem using QTextCursor::beginEditBlock(). It appears to be a bug but perhaps I'm just not using it properly. The following code snippet illustrates the problem (Qt 4.8):
@ qDebug()<<"root frame="<<ui->textEdit->document()->rootFrame();
tc.beginEditBlock(); // create a table QTextTable *cframe=tc.insertTable(2,2); tc.insertText("D"); qDebug()<<"table pointer = "<<cframe; qDebug()<<"rtf cursor table = "<<tc.currentTable(); qDebug()<<"rtf cursor current frame="<<tc.currentFrame(); tc.endEditBlock();@
If the lines tc.beginEditBlock() and tc.endEditBlock() are commented out the above code works perfectly but if the lines are included then the currentTable and currentFrame lines return the root frame instead of the table frame. However the cursor tc is positioned properly in both cases as illustrates by the text insert (the above code is a simplified version of my real code but illustrates the basic problem).
Has anyone else run into this problem and found a solution? I don't really want to remove the beginEditBlock() directive as it slows down the processing considerably but I may have to if I can't solve the problem.