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. QTextTable problem with QTextCursor
Forum Updated to NodeBB v4.3 + New Features

QTextTable problem with QTextCursor

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.1k 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    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!

    raven-worxR 1 Reply Last reply
    0
    • ivanicyI ivanicy

      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!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      ivanicyI 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @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.

        ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        @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.

        raven-worxR 1 Reply Last reply
        0
        • ivanicyI ivanicy

          @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.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @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.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • ivanicyI Offline
            ivanicyI Offline
            ivanicy
            wrote on last edited by
            #5

            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

            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