Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextCursor beginEditBlock bug?

QTextCursor beginEditBlock bug?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 707 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pt_develop
    wrote on last edited by
    #1

    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();
    QTextCursor tc=ui->textEdit->textCursor();

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved