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. QLineEdits and QPushButtons don't maintain their sizes
Forum Updated to NodeBB v4.3 + New Features

QLineEdits and QPushButtons don't maintain their sizes

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.2k 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.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    Hi,

    I designed a form using the designer, it has many lineedits and several buttons. When the program starts everything looks fine until I click the maximize button, every widget shrinks vertically. I thought it was cause because I have small monitor.

    When I tried to run on a much larger monitor, I still get the same behavior even there is plenty of white space all around. The lineedits and pushbutton are inside a girdlayout. How can I fix it?

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

      Hi,

      Did you add a spacer item at the bottom of your grid ? Or a stretch ? What exact result would you like ?

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

        I only added horizontal spacer. I just want the form to display the lineedits and pushbuttons big enough for text to display completely and not be partially visible where part to the text from top and bottom is cut off and sometimes it's difficult to read the text on the pushbuttons.

        Everything looks perfect in the designer.

        I want to add that the layout which contains the lineedits and pushbuttons is inside a widget.

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

          Do you have labels + controls on your grid ?

          If so, you should rather consider using QFormLayout

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

            There are labels. What do you mean by controls?

            Is there any other way around this? The only reason I used a gridlayout instead of formlayout is some of the input I need require multiple columns and formlayout allows for a label and lineedit in each row.

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

              By control I mean widgets (custom or not)

              That's not true, QFormLayout allows complex widgets and layouts (see the addRow overloads. It just happens that the classic use case involves 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
              • Andy314A Online
                Andy314A Online
                Andy314
                wrote on last edited by Andy314
                #7

                Check the preview function of the FormDesigner. I here all ok ?
                What happens if you resize the running windows a little bit with the mouse - not maximize ?
                Have you code behind the button click, what makes something with widgets ?

                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