Results 1 to 5 of 5

Thread: QImage on QPushButton

  1. #1
    Join Date
    May 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QImage on QPushButton

    Hi, i used QPixmap and QImage to load an image into a label. The problem here is that i have no clicked() as signal to connect it. Another user suggested me to use QPushbuttn and set it to flat, so i used QIcon to add che image, but doing this the image is only a little icon. Is there the possibility to enlarge it, or another class to use instead the QIcon?

  2. #2
    Join Date
    Nov 2010
    Posts
    20
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QImage on QPushButton

    You could try calling setIconSize on your button.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QImage on QPushButton

    Use QAbstractButton::iconSize. Or stick to the label and add your own click signal reimplementing the mouse press and release event.

  4. #4
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: QImage on QPushButton

    In some other forum a user realised the answer to be "Ah, sorry. So it really is as simple as inheriting from [that is: subclassing] a QLabel and reimplementing the mousePressedEvent or mouseReleaseEvent." -- you can call your custom signal from those.

  5. #5
    Join Date
    May 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage on QPushButton

    Quote Originally Posted by Octal View Post
    You could try calling setIconSize on your button.
    Damn...so simple. Sometimes i'm able to arrange very complex things, and sometimes i overlook simple stuff like this.
    However, thanks.

Similar Threads

  1. Replies: 0
    Last Post: 22nd February 2010, 09:30
  2. Qpushbutton
    By iamhere in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2008, 04:40
  3. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11
  4. Replies: 3
    Last Post: 26th September 2006, 12:16
  5. Replies: 3
    Last Post: 15th March 2006, 11:44

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.