Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How can I Fill a 2D QVector with a Loop and Get the size of each Row?
QtWS25 Last Chance

How can I Fill a 2D QVector with a Loop and Get the size of each Row?

Scheduled Pinned Locked Moved Solved C++ Gurus
5 Posts 2 Posters 2.1k Views
  • 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.
  • E Offline
    E Offline
    Eduardo12l
    wrote on last edited by
    #1

    I have a QVector<QVector<QString>> Temporal and I dont know how to fill it with "for" and dont know how to get the size of each row.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      For the size, just iterate over each row of your vector and call the size function.

      As for filling, create a QVector for each row and append it to your main QVector object.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi,

        For the size, just iterate over each row of your vector and call the size function.

        As for filling, create a QVector for each row and append it to your main QVector object.

        E Offline
        E Offline
        Eduardo12l
        wrote on last edited by
        #3

        @SGaist How can i insert a QVector into a QVector?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          QVector::append

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          E 1 Reply Last reply
          1
          • SGaistS SGaist

            QVector::append

            E Offline
            E Offline
            Eduardo12l
            wrote on last edited by
            #5

            @SGaist Thx it works great.

            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