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. [Solved] reduce space-size of buttons
Qt 6.11 is out! See what's new in the release blog

[Solved] reduce space-size of buttons

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.0k 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.
  • C Offline
    C Offline
    clepto
    wrote on last edited by
    #1

    Hello,

    look at the pictures here:
    [url]http://ubuntuone.com/6rpPTkQeIauvyZQhMoUh0p[/url]
    [url]http://ubuntuone.com/47k64UGZRjpzVL0aEkADay[/url]

    as you can see i have some buttons and i want to reduce the space between them, in the second picture you can see that the button get the most space...
    i have created the button with this code (example for play button) :
    @mplay_pauseButton.setIcon(mplayIcon);
    mplay_pauseButton.setIconSize(mplayPixmap.rect().size());
    mplay_pauseButton.setFlat(true);@ were mplayPixmap is the pixmap with the icon

    any idea how to reduce the space?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      If you have put the buttons into a layout, try to reduce the spacing and/or contents margins of the layout:

      @
      layout->setSpacing(0);
      layout->setContentsMargins(0, 0, 0, 0);
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • C Offline
        C Offline
        clepto
        wrote on last edited by
        #3

        i did it but the result is the same...

        1 Reply Last reply
        0
        • S Offline
          S Offline
          soundar
          wrote on last edited by
          #4

          Try to use QSize function and fix the values for HEIGHT and WIDTH.
          #include <QSize>
          QSize::QSize ( int width, int height )

          Don't Follow Anyone but You Must Learn From Everyone.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            clepto
            wrote on last edited by
            #5

            i used QToolButton and the size of the buttons reduced! i'll marked it as solved

            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