QTableView QModelIndex isVisible?
-
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.
-
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 -
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 -
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.
@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 :)
- Does the viewport Rect of the QTableView meet the Rect of each QModelIndex you tell me?