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. Top Most in Scroll Area
Qt 6.11 is out! See what's new in the release blog

Top Most in Scroll Area

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.3k Views 1 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.
  • M Offline
    M Offline
    MamdouhAlShamy
    wrote on last edited by
    #1

    hi,

    how to get the top most displayed item in QScroll Area independent on Vertical Scroll Bar Position

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Can you elaborate?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MamdouhAlShamy
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MamdouhAlShamy
              wrote on last edited by
              #6

              thx Andre
              ur help was amazing and fast

              1 Reply Last reply
              0

              • Login

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