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. How to resize a button in a grid layout?
Forum Updated to NodeBB v4.3 + New Features

How to resize a button in a grid layout?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 3.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
    judethedude
    wrote on 5 Mar 2022, 00:20 last edited by judethedude 3 May 2022, 00:28
    #1

    Hi everyone,
    I've been learning PyQt5 and it's been a fun experience so far. I'm working with QDesigner currently and have a question about how to resize a button within a grid layout:
    8c26c227-0790-47e4-bffe-62c58e28eef6-image.png

    I'd like to shrink the size of the first column (or button directly?)...but I can't figure it out. I've tried using column stretch: 9d41b198-6554-4ef8-9209-d443d322903e-image.png
    But it seems there is a minimum size for that first column, anyone have any advice?
    Edit: I should mention, column stretch has worked perfectly for my other grid layout GroupBox:
    dee3aa4d-434b-4132-ab21-33c044682fed-image.png

    Edit2: Bonus question :)
    Any idea how I can reduce this blank space?
    123cbcd5-76dc-4385-8119-7340c4a28a77-image.png
    44bd9d40-85d0-40e1-9e8a-8d1922c2d5aa-image.png

    I tried messing with the top margin but that didn't have the desired effect. Thanks again.

    Regards,
    Jude

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on 5 Mar 2022, 00:47 last edited by mpergand 3 May 2022, 00:51
      #2

      Hi,

      For the button you can set a maximum width .
      For extra spaces, check all the layouts contentsMargins and spacings settings.
      Or add a vertical spacer at the bottom.

      J 1 Reply Last reply 5 Mar 2022, 16:35
      2
      • M mpergand
        5 Mar 2022, 00:47

        Hi,

        For the button you can set a maximum width .
        For extra spaces, check all the layouts contentsMargins and spacings settings.
        Or add a vertical spacer at the bottom.

        J Offline
        J Offline
        judethedude
        wrote on 5 Mar 2022, 16:35 last edited by
        #3

        @mpergand
        Thanks for the reply, I will try that out.

        1 Reply Last reply
        0

        1/3

        5 Mar 2022, 00:20

        • Login

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