Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting an icon's size on a QPushButton through Stylesheets
Qt 6.12 LTS is out! See what's new in the release blog

Setting an icon's size on a QPushButton through Stylesheets

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 2.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.
  • Dummie1138D Offline
    Dummie1138D Offline
    Dummie1138
    wrote on last edited by Dummie1138
    #1

    Hi. I'm trying to set an icon's size on a QPushButton through Stylesheets. I am unable to locate the proper syntax that would allow me to modify the icon's size when I implement the icon image from the stylesheet.

    This is my code, based on this suggestion. Adjusting the size to 64 or 256 did not change the size of the object.

    "QPushButton#pushButton_Calibration {image: url(:/images/toolkit_" + textColor + ".png); qproperty-iconSize: 128px;}"
    

    This is my other code, based on this other suggestion. Adjusting the width/height to 64 or 256 did not change the size of the object.

    "QPushButton#pushButton_Calibration {image: url(:/images/toolkit_" + textColor + ".png); width: 128px; height: 128px;}"
    

    I am aware that something like this is an option:

    ui->pushButton_Calibration->setIconSize(QSize(128, 128));
    

    But I am unsure on how to implement this to something with the format QPushButton#pushButton_Calibration.

    Please let me know if more information is required to solve this issue. I am unfamiliar with the syntax needed to change the size of the icon and haven't been able to locate it from the documentation.

    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
    • Unsolved