Results 1 to 2 of 2

Thread: How to get pushbutton as an icon

  1. #1
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Red face How to get pushbutton as an icon

    Hello,

    I have a simple problem which I can't seem to find in the API. I have an icon in png format, say 32x32. I'd like to create a pushbutton of size 90x90 which displays the entire icon, enlarged. But only one copy of the icon should be displayed, not multiple overlapping ones as defined in setstylesheets.

    I've tried both seticon and setstylesheets. Set icon doesn't enlarge the icon, while setstylesheets makes many copies of the icon until the button is filled.

    Any help would be appreciated, Thanks.

    Regards,
    Pembar

  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: How to get pushbutton as an icon

    You can't obtain what you want with the default Qt widgets. You either need to subclass the button class and scale the icon yourself before painting it or use QLabel instead of the button but then you'll have to provide the clicking functionality yourself. Just remember that images scaled up look very bad so rethink your approach before you start implementing anything.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 22:20
  2. button with backgr and icon using stylesheets
    By s_p_t10 in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2008, 21:19
  3. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 20:03
  4. connecting image to a pushbutton
    By sudheer in forum Qt Tools
    Replies: 2
    Last Post: 4th December 2007, 10:23
  5. Mac application and the Dock Icon
    By sekelsenmat in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 11:23

Tags for this Thread

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.