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. QTableWidget how to get number of rows in each cell

QTableWidget how to get number of rows in each cell

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.3k 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.
  • D Offline
    D Offline
    dzungng
    wrote on last edited by dzungng
    #1

    Hi,

    i created a table with a given number of rows and columns. I also used setSpan() to merge some cells together.

    Now i need to retrieve the number of rows and columns in each cell after merging. Is there a method to loop through all merged cells to get the data I want?

    I thought of using rowCount() and columnCount() but it only works with the whole table.

    Thank you all

    JonBJ 1 Reply Last reply
    0
    • D dzungng

      Hi,

      i created a table with a given number of rows and columns. I also used setSpan() to merge some cells together.

      Now i need to retrieve the number of rows and columns in each cell after merging. Is there a method to loop through all merged cells to get the data I want?

      I thought of using rowCount() and columnCount() but it only works with the whole table.

      Thank you all

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @dzungng
      You have to march through the cells of the table reading their QTableView::column/rowSpan(int row, int column) to calculate what is there including spanning.

      1 Reply Last reply
      3
      • D Offline
        D Offline
        dzungng
        wrote on last edited by
        #3

        Thank you for your answer.
        I created a table using QTableWidget. Can I use the function you recommended for QTableWidget?

        JonBJ 1 Reply Last reply
        0
        • D dzungng

          Thank you for your answer.
          I created a table using QTableWidget. Can I use the function you recommended for QTableWidget?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @dzungng
          QTableWidget inherits from QTableView. That means all QTableView methods are also available on a QTableWidget. This principle is worth understanding, as it applies all over the place with QWidgets (and other Qt derived classes).

          1 Reply Last reply
          4

          • Login

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