Results 1 to 2 of 2

Thread: Stretching Icon in QPushButton

  1. #1
    Join Date
    Oct 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Stretching Icon in QPushButton

    Hi,

    As my form resizes, the QPushButton resizes as well. However, the size of the icon inside the QPushButton is always the same size, no matter what I do. How can I make so the icon dynamically resizes so that it always fits the size of the entire push button?

    Is there some other widget I should be using?

    Thanks!

    -Dan

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Stretching Icon in QPushButton

    If you need it to be "pushable" then you have to subclass QPushButton (or QAbstractButton) and either draw the button yourself or stretch and apply a new icon. But if you just want the icon to be shown, you can use QLabel and tell it to scale its contents.

Similar Threads

  1. Mac application and the Dock Icon
    By sekelsenmat in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 10:23
  2. QPushbutton Flat property and icon appearance.
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2006, 08:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.