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. QGroupBox is filled with too much space.
Forum Updated to NodeBB v4.3 + New Features

QGroupBox is filled with too much space.

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 6.3k Views 3 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.
  • P Pippin

    @mrjj Thanks for your reply. I've changed LocalIp.resize(75, 20); with LocalIp.setMinimumHeight(20); but the result is the same I'm afraid :(

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #4

    @Pippin
    Well if you want it 20 , then
    LocalIp.setMaximumHeight(20)
    so at most 20.

    you could also limit the left side to prevent it from making lower box smaller

    P 1 Reply Last reply
    0
    • mrjjM mrjj

      @Pippin
      Well if you want it 20 , then
      LocalIp.setMaximumHeight(20)
      so at most 20.

      you could also limit the left side to prevent it from making lower box smaller

      P Online
      P Online
      Pippin
      wrote on last edited by
      #5

      @mrjj Okay thanks, now I get this: http://i.imgur.com/Oyt3gnT.png

      It's better but still poorly spaced. I've tried to change the spacing of DirectLineBoxLayout but the result remains the same.

      mrjjM 1 Reply Last reply
      0
      • P Pippin

        @mrjj Okay thanks, now I get this: http://i.imgur.com/Oyt3gnT.png

        It's better but still poorly spaced. I've tried to change the spacing of DirectLineBoxLayout but the result remains the same.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @Pippin
        oh, hmm, it divides the area (of the container) between them.
        You could insert a VerticalSpacer to push them up.

        http://postimg.org/image/4eu5m4xy5/

        P 1 Reply Last reply
        0
        • mrjjM mrjj

          @Pippin
          oh, hmm, it divides the area (of the container) between them.
          You could insert a VerticalSpacer to push them up.

          http://postimg.org/image/4eu5m4xy5/

          P Online
          P Online
          Pippin
          wrote on last edited by
          #7

          @mrjj Ok but isn't there any way to actually reduce the area? Why does it have to be bigger than all the widgets together?

          mrjjM 1 Reply Last reply
          0
          • P Pippin

            @mrjj Ok but isn't there any way to actually reduce the area? Why does it have to be bigger than all the widgets together?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #8

            @Pippin
            The area is also scaled to its container layout so that is where it get its height.
            maybe QLayout::setAlignment can make it stack more to the top but
            i mostly just insert a spacer.

            P 1 Reply Last reply
            0
            • mrjjM mrjj

              @Pippin
              The area is also scaled to its container layout so that is where it get its height.
              maybe QLayout::setAlignment can make it stack more to the top but
              i mostly just insert a spacer.

              P Online
              P Online
              Pippin
              wrote on last edited by
              #9

              @mrjj QLayout::setAlignment doesn't seem to work with DirectLineBoxLayout. I'll try to find another way.

              It sometimes is very frustrating how full of bugs Qt is.

              mrjjM 1 Reply Last reply
              0
              • P Pippin

                @mrjj QLayout::setAlignment doesn't seem to work with DirectLineBoxLayout. I'll try to find another way.

                It sometimes is very frustrating how full of bugs Qt is.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @Pippin
                Well you can set Maximum Height on the layout to force area smaller.

                It is possible to build using a widget as place holder.
                Have a look at this.
                https://www.dropbox.com/s/pdlb6jeph7iobc9/opper.zip?dl=0

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

                  Hi,

                  Maybe a silly question but since it's for IP addresses, why not use a QLineEdit ?

                  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
                  • P Online
                    P Online
                    Pippin
                    wrote on last edited by
                    #12

                    @SGaist Good point, I use QLineEdits now. My problem remains though: http://i.imgur.com/raW29vW.png

                    Neither QVBoxLayout::addStretch (result is unchanged) nor QGroupBox::setMaximumHeight (result: http://i.imgur.com/FklMI9g.png) seem to work here.

                    I'd rather have the extra space disappear rather than add a spacer or something. The smaller the window, the better.

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

                      For the layout of your dialog, I think you should have a look at QFormLayout

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

                      P 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        For the layout of your dialog, I think you should have a look at QFormLayout

                        P Online
                        P Online
                        Pippin
                        wrote on last edited by
                        #14

                        @SGaist I can't use QFormLayouts because I need to display a Connect QPushButton as well as a Host QPushButton. Or is there a way around this?

                        1 Reply Last reply
                        0
                        • P Online
                          P Online
                          Pippin
                          wrote on last edited by
                          #15

                          Well never mind, I'll just drop the IP info so that there's no more bug.

                          It is absurd how Qt has that many bugs. Before coding tip-top things, Qt's coders should make sure that the most basic (BASIC) things actually work. I wish I didn't have to use Qt. It is so very overrated. Sorry for that, but I'm both exasperated and disappointed. That's not the first unsolvable problem I've come across.

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

                            You would put your QLineEdit and two QPushButton in a QHorizontalLayout. QFormLayout::addRow supports also layouts.

                            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