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]Automatic resize to fit the elements in a Dialog

[Solved]Automatic resize to fit the elements in a Dialog

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.5k Views
  • 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.
  • T Offline
    T Offline
    TheDestroyer
    wrote on 21 Apr 2012, 18:53 last edited by
    #1

    Hello guys,

    I have a dialog that has some elements/controls that depending on some options gets some controls inside it to be visible or not. The problem is, when many items are invisible, the dialog looks empty, and one has to resize it (make it smaller), to make it look normal with no empty spaces in it.

    I want to restore the Window size to what Qt would choose automatically to fit the elements inside the dialog. Is there such a call?

    Thanks for any efforts :)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      d2uriel
      wrote on 21 Apr 2012, 19:51 last edited by
      #2

      Are you using layouts?

      "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TheDestroyer
        wrote on 21 Apr 2012, 22:33 last edited by
        #3

        Yes. QGridLayout.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TheDestroyer
          wrote on 23 Apr 2012, 10:17 last edited by
          #4

          I'd love to hear it if it's impossible!!! please, any clue?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on 23 Apr 2012, 21:47 last edited by
            #5

            Did you try to call something like this in the slot that shows/hides the optional parts:

            @
            resize(sizeHint());
            // or
            resize(minimumSizeHint());
            @

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TheDestroyer
              wrote on 24 Apr 2012, 07:35 last edited by
              #6

              Thanks a lot!!! @resize(minimumSizeHint());@ did it :)

              I'm grateful!

              1 Reply Last reply
              0

              6/6

              24 Apr 2012, 07:35

              • Login

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