Results 1 to 9 of 9

Thread: checkBox

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default checkBox

    Hi, I'm trying to set background to my cheack box; I'd like set it to a png; is it possible?
    This below compile but the background is gray....Thanks
    Qt Code:
    1. mycheck->setBackgroundPixmap(QPixmap::fromMimeSource("face.png"));
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: checkBox

    Have you try it this way:
    Qt Code:
    1. mycheck->setBackgroundPixmap(QPixmap("face.png"));
    To copy to clipboard, switch view to plain text mode 

    In other way, is the path of the image correct?
    Last edited by SkripT; 31st March 2006 at 00:01.

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: checkBox

    sorry but don't happen nothing...
    Regards

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: checkBox

    nothing hint for this?
    Regards

  5. #5
    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: checkBox

    But is the path correct or not? Can you display the pixmap on a QLabel?

  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: checkBox

    yes I have in .pro the line /images/face.png, because it is also a pixmap on a button. I haven't any error of path...
    Regards

  7. #7
    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: checkBox

    The attached app works fine for me. I think you have a problem with the pixmap image path. Does it start with "/"? I guess it shouldn't. Are you sure you load the pixmap to the button exactly the same way?
    Attached Files Attached Files

  8. #8
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: checkBox

    Sorry; we didn't understand! I'd like set the face.png inside the square of checkBox where, when I click, apper the "V". Are you understand? Is it possible?
    Thanks for all.
    Regards

  9. #9
    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: checkBox

    You'd have to subclass QCheckBox to do that. Or implement your own QStyle.

Similar Threads

  1. Replies: 3
    Last Post: 1st April 2011, 04:58
  2. boolean field checkbox QTableView
    By skuda in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2010, 13:48
  3. QTreeView: How to center a checkbox in a cell
    By chezifresh in forum Qt Programming
    Replies: 3
    Last Post: 19th December 2008, 12:11
  4. Need some help re-painting a checkbox
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 16:08
  5. checkbox
    By nErnie in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2006, 21:59

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.