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. Centre align in QToolButton
Qt 6.11 is out! See what's new in the release blog

Centre align in QToolButton

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 573 Views
  • 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
    shreya_agrawal
    wrote on last edited by
    #1

    How to centre align the icon and text in a QToolButton?

    Screenshot from 2025-07-18 14-45-24.png

    Methods I tried:

    a. padding-left: 10px;
    This just increases the size of the button, but doesn't shift elements to right.

    b. text-align: center;
    It has no effect on the alignment of either the icon or the text.

    S 1 Reply Last reply
    0
    • S shreya_agrawal

      How to centre align the icon and text in a QToolButton?

      Screenshot from 2025-07-18 14-45-24.png

      Methods I tried:

      a. padding-left: 10px;
      This just increases the size of the button, but doesn't shift elements to right.

      b. text-align: center;
      It has no effect on the alignment of either the icon or the text.

      S Offline
      S Offline
      shreya_agrawal
      wrote on last edited by
      #2

      @shreya_agrawal

      Found a hack for this. Morph the QToolButton to a QPushButton.

      1 Reply Last reply
      0
      • S shreya_agrawal has marked this topic as solved on

      • Login

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