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. qtoolbutton/qpushbutton icon based on button's size
Forum Updated to NodeBB v4.3 + New Features

qtoolbutton/qpushbutton icon based on button's size

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 2 Posters 9.4k 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #12

    @mrjj
    i managed to do that but i want to remove all spaces between buttons.
    i've set setContentsMargins(0, 0, 0, 0) and setSpacing(0) for the layout.
    this is what i have now: https://ibb.co/qYCm8vR
    can't i remove those spaces?

    mrjjM 1 Reply Last reply
    0
    • U user4592357

      @mrjj
      i managed to do that but i want to remove all spaces between buttons.
      i've set setContentsMargins(0, 0, 0, 0) and setSpacing(0) for the layout.
      this is what i have now: https://ibb.co/qYCm8vR
      can't i remove those spaces?

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

      @user4592357
      Hi
      The tool buttons seems to reserve some pixels so there will be a small space.
      alt text

      The lower ones are Frames and both layouts have same settings so its fair to say
      its the closest you get with ToolButtons as seen in top.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        user4592357
        wrote on last edited by
        #14

        @mrjj
        hi,
        when i add the buttons to a layout, they take up more space (just because it's available).
        how can i make the buttons be in their minimum size in that layout?

        p.s. this is what i have set for the button:

        setMinimumSize(...);
        setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
        
        mrjjM 1 Reply Last reply
        0
        • U user4592357

          @mrjj
          hi,
          when i add the buttons to a layout, they take up more space (just because it's available).
          how can i make the buttons be in their minimum size in that layout?

          p.s. this is what i have set for the button:

          setMinimumSize(...);
          setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
          
          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #15

          @user4592357
          But would would be the minimum ?
          You can set setMaximumSize of them if you want to limit it to
          certain size. like 64x64. else layout makes them use the extra space.

          U 1 Reply Last reply
          0
          • mrjjM mrjj

            @user4592357
            But would would be the minimum ?
            You can set setMaximumSize of them if you want to limit it to
            certain size. like 64x64. else layout makes them use the extra space.

            U Offline
            U Offline
            user4592357
            wrote on last edited by user4592357
            #16

            @mrjj
            no i don't want max size...
            i thought i could add a spacer at column 0 and last column, and set stretch factor to those columns

            mrjjM 1 Reply Last reply
            0
            • U user4592357

              @mrjj
              no i don't want max size...
              i thought i could add a spacer at column 0 and last column, and set stretch factor to those columns

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

              @user4592357
              im not sure i understand.
              You do not want a max size for widgets but at same time they are not allowed to use
              all the space ?
              well yes spacers should compress to minimum

              1 Reply Last reply
              0
              • U Offline
                U Offline
                user4592357
                wrote on last edited by
                #18

                yes maybe that's weird but that's what i need.
                when i added the spacer at col 0, and then the rest of the widgets, only the first widget got added.

                mrjjM 1 Reply Last reply
                0
                • U user4592357

                  yes maybe that's weird but that's what i need.
                  when i added the spacer at col 0, and then the rest of the widgets, only the first widget got added.

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

                  @user4592357
                  Im not sure what you mean . Adding cant fail due to spacer.
                  did you set Minimum on the widgets as else they get compressed totally.

                  alt text

                  with no Minimum set
                  alt text

                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    user4592357
                    wrote on last edited by user4592357
                    #20

                    i added spacers at both ends of hbox layout, but now the whole container widget gets larger instead of the buttons getting smaller (since there is a spacer around them)...

                    mrjjM 1 Reply Last reply
                    0
                    • U user4592357

                      i added spacers at both ends of hbox layout, but now the whole container widget gets larger instead of the buttons getting smaller (since there is a spacer around them)...

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

                      @user4592357
                      Hi
                      Its impossible to guess at with no code or pictures.
                      If i do the same with Horz layout i get this
                      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