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. Is there a "layout complete" event?
Forum Updated to NodeBB v4.3 + New Features

Is there a "layout complete" event?

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

    I am making a simple multi-page document viewer. I have an initially empty QScrollArea, to whose layout I add
    several (or many) QLabel widgets. I create and size these QLabels and add them to the layout in a loop, which does not take long.

    The problem is that right after this, I try and determine which ones are visible within the QScrollArea using
    visibleRegion(), but none of them appear visible. If, however, I go away for 200 msec (using a QTimer)
    and try again, I then get the results I expect.

    So, question: how can I determine exactly when the sizing/layout of these QLabels is actually done?

    Thanks.

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

      Hi,

      You could use the showEvent method from your QScrollArea container.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fredrossperry
        wrote on last edited by
        #3

        Thanks for your reply. I was able to put an event filter on the scroll area's content widget, and watch for QEvent::LayoutRequest.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Nice, but AFAIK, that event means that the layout should be updated, not that it has already happened

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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