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. [Solved] How to hide a QBoxLayout and all its content?
Forum Updated to NodeBB v4.3 + New Features

[Solved] How to hide a QBoxLayout and all its content?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 23.8k 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.
  • J Offline
    J Offline
    jesuisbenjamin
    wrote on last edited by
    #1

    Hi,

    I have an interface composed of two QHBoxLayout embedded in a QVBoxLayout. The top QHBoxLayout and its content should remain visible at all time, whereas the bottom QHBoxLayout should be able to toggle hide/show on request from widgets in the top QHBoxLayout. (I hope my description is clear).

    I haven't found a hide/show method in QBoxLayout. I tried to set two alternate geometries to the lower QHBoxLayout (height 500 vs. height 0) but the latter didn't change anything -- perhaps because the content of the lower QHBoxLayout is forcing its size to the layout.

    How could i achieve this feature? Can i do this with the existing layouts or do i need to derive a new subclass and inherit a show/hide from some other QObject? Ideally i'd like to have an animation on resizing the lower QHBoxLayout, that is I'd like it to resize gradually, possibly with a time-step: so in that case, should the show/hide feature be based on changing the height of the QHBoxLayout?

    Thanks.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goblincoding
      wrote on last edited by
      #2

      I would change my interface so that it is composed of two separate QWidgets, each with its own QHBoxLayout containing whatever your box layouts contain, and then simply call hide()/show() on the widget in question.

      Does that make sense or do I need to be more descriptive?

      EDIT: I wouldn't know how to make the hiding process happen gradually though...

      http://www.goblincoding.com

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jesuisbenjamin
        wrote on last edited by
        #3

        Ha! it sounds like a nice idea. What you propose in fact, is to use the QWiget as a container. I'm going to see if that works out.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jesuisbenjamin
          wrote on last edited by
          #4

          I am also wondering as to whether i could use a QDockWidget with the top Widget as a central widget and the dock to the south of the central widget.

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            In the official Qt book C++ GUI Programming with Qt 4 there is a chapter explaining what you want: shape changing dialogs.

            You can get the book from this page:
            "Link ":http://doc.qt.nokia.com/4.7/how-to-learn-qt.html

            Have fun reading it.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jesuisbenjamin
              wrote on last edited by
              #6

              Thanks Eddy.

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #7

                You're welcome.

                I didn't notice this question before

                bq. I am also wondering as to whether i could use a QDockWidget with the top Widget as a central widget and the dock to the south of the central widget.

                This is possible also.

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jesuisbenjamin
                  wrote on last edited by
                  #8

                  QDockWidget is what i needed. Thanks.

                  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