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. QTableView QModelIndex isVisible?
QtWS25 Last Chance

QTableView QModelIndex isVisible?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 911 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.
  • P Offline
    P Offline
    Pada_
    wrote on last edited by
    #1

    I am using Qt 5.4.0 + Windwos 8.1 64Bit.

    I created a QTableView using ProxyWidget for QGraphicsView.

    This item is adjustable in size.

    When the size of the QTableView decreases, a scrollbar is created.

    In that state, I want to know the QModelIndex lowest column, highest column, lowest row, and highest row.

    How can I know?

    Thank you.

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

      Hi
      What is currently being shown is being handled by the View.
      The model does not know anything about it.
      However, you can use
      https://doc.qt.io/qt-5/qabstractitemview.html#visualRect
      to check if a given index() is shown.
      They talk about it here
      https://forum.qt.io/topic/53269/solved-list-of-visible-rows-in-the-viewport-of-qtableview

      P 1 Reply Last reply
      3
      • mrjjM mrjj

        Hi
        What is currently being shown is being handled by the View.
        The model does not know anything about it.
        However, you can use
        https://doc.qt.io/qt-5/qabstractitemview.html#visualRect
        to check if a given index() is shown.
        They talk about it here
        https://forum.qt.io/topic/53269/solved-list-of-visible-rows-in-the-viewport-of-qtableview

        P Offline
        P Offline
        Pada_
        wrote on last edited by
        #3

        @mrjj

        Does the viewport Rect of the QTableView meet the Rect of each QModelIndex you tell me? Judging by the comparison is showing on the screen. Thank you.

        mrjjM 1 Reply Last reply
        0
        • P Pada_

          @mrjj

          Does the viewport Rect of the QTableView meet the Rect of each QModelIndex you tell me? Judging by the comparison is showing on the screen. Thank you.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @pada_
          Hi
          The viewport draws the items.
          each item has a rect, and the viewport has a rect
          so we can use visualrect to see if an item is within the viewport and therefore visible.

          • Does the viewport Rect of the QTableView meet the Rect of each QModelIndex you tell me?
            Im not 100% sure what this sentence means, but i feel like saying yes :)
          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