Top Most in Scroll Area
-
hi,
how to get the top most displayed item in QScroll Area independent on Vertical Scroll Bar Position
-
It depends on what you have on display there exactly. If you have just one column of items, you have a different situation then if you have items (widgets probably, on a QScrollArea) all over the place. It also depends on how you define "top most displayed". Does an item where only the bottom few pixels are still showing count, or do you need to have the top most item who's top is visible?
-
the top most item who’s top is visible
i have QScrollArea of Widget items and want to fetch the topmost item who is visible on top
-
So... get the rects of the widgets in your scroll area, sort them by their top (y) coordinate, and find the first rect that has a top that is bigger or equal to the coordinate that is at the top of your scroll area. QWidget (baseclass of your scroll area) supplies the needed mapTo functions to get the top visible line.
-
thx Andre
ur help was amazing and fast