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. Adding widget to invisible layout won't make it update
Qt 6.11 is out! See what's new in the release blog

Adding widget to invisible layout won't make it update

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.1k 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.
  • D Offline
    D Offline
    dextermagnific
    wrote on last edited by
    #1

    Hi all,

    I have a specific problem with layout updates.
    My application shows a TabWidget with multiple tabs. One of this tabs shows a "preview" area of what I'm editing (a QScrollArea with the previewed thing inside). The preview area is layed out with other widgets on the same tab.

    I have an "attach"/"detach" button that when clicked removes the preview area and makes it a top level window (with reparent()). "attach" re-attaches the preview area by inserting it in the layout again. The preview area is also automaticallty re-attached when it is closed through the window manager.

    The problem: as soon as the tab that contains the preview area is visible, reattaching is done well: I see the preview area in the layout, updates are done and it pushes other widgets with regards to its size policy.

    If the tab is not visible (switched to another tab), when I close the preview window then switch to the tab where it is re-attached, I don't see the preview area. Seems like layout recalculation is not done if the layout is not visible.

    I tried all the layout->update()|invalidate()|activate() stuff with no success.

    Do you have any ideas about this ?

    Thank you.

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

      Hi,

      You should also add which version of Qt and OS you are currently using

      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
      • D Offline
        D Offline
        dextermagnific
        wrote on last edited by
        #3

        I use Qt 4.8.5 on Linux (Kubuntu prebuilt packages)

        I tried to activate the tab programmatically before re-attaching the preview and it worked.

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

          So you bring back the right tab, attach the preview and the switch back to the tab that was selected before ?

          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
          • D Offline
            D Offline
            dextermagnific
            wrote on last edited by
            #5

            Extacly :) This seems to cause no flicker (how is this possible ?).

            That's strange because when designer generates code, it does not switch tabs before adding tab widgets. But that's another use case because it first populates the tab then adds it to the tab widget.

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

              Maybe because your machine is fast enough ;)

              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