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. How do I iterate across the columns of a QTableView so I can find the total width of the table?
Forum Updated to NodeBB v4.3 + New Features

How do I iterate across the columns of a QTableView so I can find the total width of the table?

Scheduled Pinned Locked Moved Solved General and Desktop
qtableview c++dialog
6 Posts 3 Posters 718 Views 2 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by jdent
    #1

    Hi,

    I need to find the total width of a QTableView and size() is not giving me that so I thought I would add the width of each column.... but where are the columns of a QTableView?? There are no ColumnCount() method....
    How do I find the number of columns in the tableview?

    M 1 Reply Last reply
    0
    • J jdent

      @Axel-Spoerl How can I get the vertical scrollbar of the QTableView?

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #6

      @jdent said in How do I iterate across the columns of a QTableView so I can find the total width of the table?:

      @Axel-Spoerl How can I get the vertical scrollbar of the QTableView?

      Simply with verticalScrollBar()
      cause QTableView inherits of QAbstractScrollArea ;)

      1 Reply Last reply
      1
      • J jdent

        Hi,

        I need to find the total width of a QTableView and size() is not giving me that so I thought I would add the width of each column.... but where are the columns of a QTableView?? There are no ColumnCount() method....
        How do I find the number of columns in the tableview?

        M Offline
        M Offline
        mpergand
        wrote on last edited by
        #2

        @jdent

        Look at QHeaderView::count()
        for horizontalHeader()

        J 1 Reply Last reply
        0
        • M mpergand

          @jdent

          Look at QHeaderView::count()
          for horizontalHeader()

          J Offline
          J Offline
          jdent
          wrote on last edited by jdent
          #3

          @mpergand ok, all I need now is the width of the vertical scrollbar and will be able to calculate what the width of the dialog needs to be!!

          Axel SpoerlA 1 Reply Last reply
          0
          • JonBJ JonB referenced this topic on
          • J jdent

            @mpergand ok, all I need now is the width of the vertical scrollbar and will be able to calculate what the width of the dialog needs to be!!

            Axel SpoerlA Offline
            Axel SpoerlA Offline
            Axel Spoerl
            Moderators
            wrote on last edited by
            #4

            @jdent
            int size() returns the actual size.
            int sizeHint()is probably what you want. It returns how wide the header view wants to be in ideal circumstances.
            int sectionSizeHint(int section)returns the size hint for a given section.

            Software Engineer
            The Qt Company, Oslo

            J 1 Reply Last reply
            0
            • Axel SpoerlA Axel Spoerl

              @jdent
              int size() returns the actual size.
              int sizeHint()is probably what you want. It returns how wide the header view wants to be in ideal circumstances.
              int sectionSizeHint(int section)returns the size hint for a given section.

              J Offline
              J Offline
              jdent
              wrote on last edited by jdent
              #5

              @Axel-Spoerl How can I get the vertical scrollbar of the QTableView?

              M 1 Reply Last reply
              0
              • J jdent

                @Axel-Spoerl How can I get the vertical scrollbar of the QTableView?

                M Offline
                M Offline
                mpergand
                wrote on last edited by mpergand
                #6

                @jdent said in How do I iterate across the columns of a QTableView so I can find the total width of the table?:

                @Axel-Spoerl How can I get the vertical scrollbar of the QTableView?

                Simply with verticalScrollBar()
                cause QTableView inherits of QAbstractScrollArea ;)

                1 Reply Last reply
                1
                • J jdent has marked this topic as solved on

                • Login

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