QTextTable problem with QTextCursor



  • Hello!

    I have this scheme created with QTextCursor to write in a odf document:

    Text
    __________________________________________________________
    |                                                                                                                                                                    
    |
    |
    |                        Image
    |
    |
    __________________________________________________________
    
    QTextTable: (2 rows, 2 columns)
    __________________________________________________________
    |          image             |          image            |
    |          image             |          image            |
    __________________________________________________________ 
    
    

    At this moment, I want to put plain text under the table, but I don't know how to skip the cursor of the table. I want something like this:

    Text
    __________________________________________________________
    |                                                                                                                                                                    
    |
    |
    |                        Image
    |
    |
    __________________________________________________________
    
    QTextTable: (2 rows, 2 columns)
    __________________________________________________________
    |          image             |          image            |
    |          image             |          image            |
    __________________________________________________________ 
    
    Text line 1
    Text line 2
    Text line 3
    Text line 4
    
    

    Anybody knows how to do it?
    Thank you very much!


  • Moderators

    @ivanicy
    have you tried with QTextCursor::movePosition() yet?
    Depending on where you start from you need to choose the MoveOperation accordingly and check the cursor's current format or even QTextCursor::currentTable() to check if the cursor is currently placed inside a table.



  • @raven-worx Yes, I tried different types of movement but I can't skip the QTextTable. I tried, for example QTextCursor::NextBlock or QTextCursor::Down but, looking at the results, I think that it makes new lines in the table.


  • Moderators

    @ivanicy
    a table is not a text-block but a text-frame.
    You can also try to repeat NextCharacter moves until you are out of the table again.



  • I solved the problem using QTextCursor::NextRow and QTextCursor::Down. Some lines are included in the table but, it puts the text where I want.

    Thank you very much


Log in to reply
 

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