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. QtCreator: Make all selected buttons the same size
Forum Updated to NodeBB v4.3 + New Features

QtCreator: Make all selected buttons the same size

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 2.2k Views 2 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.
  • S Offline
    S Offline
    StringTheory
    wrote on last edited by
    #1

    Is there a command within QtCreator's dialog editor to make a selected group of buttons the same size?
    I'd also love to be able to space them at even intervals, horizontally.

    Perhaps I've been spoiled by MS Visual Studio, but this really seems like there should be a very visible command for doing this.

    J.HilkJ 1 Reply Last reply
    1
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Qt uses layouts to obtain that effect. Just select all buttons, right click and layout->layout in a grid

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      S 1 Reply Last reply
      5
      • S StringTheory

        Is there a command within QtCreator's dialog editor to make a selected group of buttons the same size?
        I'd also love to be able to space them at even intervals, horizontally.

        Perhaps I've been spoiled by MS Visual Studio, but this really seems like there should be a very visible command for doing this.

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #3

        @StringTheory
        additionally to what @VRonin said, you can select all buttons and than change the Properties on the (default) right hand side of the Designer. The changed value/property will be applied to all selected widgets.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        S 1 Reply Last reply
        5
        • VRoninV VRonin

          Qt uses layouts to obtain that effect. Just select all buttons, right click and layout->layout in a grid

          S Offline
          S Offline
          StringTheory
          wrote on last edited by
          #4

          @VRonin said in QtCreator: Make all selected buttons the same size:

          Qt uses layouts to obtain that effect. Just select all buttons, right click and layout->layout in a grid

          I'm still learning some of the quirks of Qt Creator, but I thought I had seen a 'make same size' option somewhere. I know that grids usually relate, but in some cases, I'm looking to do this with buttons in various different places within a dialog. IOW, I wouldn't want the positions to be affected, just the sizes.

          If you think my answers are wrong, please downvote me

          I dare you to say that on StackOverflow! :-) (Seriously, this is a much cooler and more helpful place)

          VRoninV 1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @StringTheory
            additionally to what @VRonin said, you can select all buttons and than change the Properties on the (default) right hand side of the Designer. The changed value/property will be applied to all selected widgets.

            S Offline
            S Offline
            StringTheory
            wrote on last edited by
            #5

            @J.Hilk said in QtCreator: Make all selected buttons the same size:

            @StringTheory
            additionally to what @VRonin said, you can select all buttons and than change the Properties on the (default) right hand side of the Designer. The changed value/property will be applied to all selected widgets.

            OK, that should work. In Microsoft's Visual Studio, there are options like 'make same size', 'align top edge', 'align bottom edge' etc. I miss those. There are places where I'd like to (for example) align the left sides of disparate object types and sizes.

            The various alignments in Qt (grid, etc) are great, but I cringe when I need to 'break' the alignment to add or rearrange, then hope that I can recreate what I had. I should find a specifically targeted tutorial on the subject. I find the Qt interface rather unintuitive at times.

            (PS: How do you get a 'reputation point'? The forum only allows replies 10 minutes apart)

            1 Reply Last reply
            1
            • S StringTheory

              @VRonin said in QtCreator: Make all selected buttons the same size:

              Qt uses layouts to obtain that effect. Just select all buttons, right click and layout->layout in a grid

              I'm still learning some of the quirks of Qt Creator, but I thought I had seen a 'make same size' option somewhere. I know that grids usually relate, but in some cases, I'm looking to do this with buttons in various different places within a dialog. IOW, I wouldn't want the positions to be affected, just the sizes.

              If you think my answers are wrong, please downvote me

              I dare you to say that on StackOverflow! :-) (Seriously, this is a much cooler and more helpful place)

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @StringTheory said in QtCreator: Make all selected buttons the same size:

              I wouldn't want the positions to be affected, just the sizes.

              You can add spacers to the layout so the widgets don't move

              @StringTheory said in QtCreator: Make all selected buttons the same size:

              I dare you to say that on StackOverflow!

              I piled so many downvotes there I don't even care anymore. It's a dangerous place for people that still use new/delete

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              2
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                Hi
                In the beginning i also missed align functions/ options but it turned out
                you use layout most of the times to allow for different resolutions/window sizes so
                it actually very rare you have free floating Widgets.

                And you can actually add / rearrage without breaking layout. but only with dragging.
                If u drag a new Widget to layout, a small blue line is shown where to insert.
                and you can rearrange same way

                alt text

                1 Reply Last reply
                1

                • Login

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