Results 1 to 3 of 3

Thread: Qpixmaps and Q_Properties

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qpixmaps and Q_Properties

    I'm looking to add pixmaps via Q_PROPERTIES. I notice that QPushButton (and similar) have nice little browsing capabilities for finding the file. I'm curious how to get that functionality with my custom widgets.

    I've thought of a few ideas:
    Q_PROPERTY(QString... [where the user could see the path they've typed in, and the path is saved for use]
    Q_PROPERTY(QPixmap...
    etc..

    but I'm not sure. Theirs displays a pixmap after you've selected/browsed for a resource/file AND displays the location. Near as I can tell these will only accomplish one or the other; and further I doubt it'll add the browsing functionality I'm speaking of.

    It may help to mention how the code-generation feature knows what code to generate. If I know this much I may be able to customize that code to my liking.

  2. #2
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qpixmaps and Q_Properties

    This is the code that the QAbstractButton uses:

    Qt Code:
    1. Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
    2. public:
    3. void setIcon(const QIcon &icon);
    4. QIcon icon() const;
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to StrikeByte for this useful post:

    tescrin (31st July 2012)

  4. #3
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qpixmaps and Q_Properties

    Thanks! I was looking for that in their code but must've missed it somehow. I'll head back and keep looking.

Similar Threads

  1. How to merge two QPixmaps in to one.
    By live_07 in forum Qt Programming
    Replies: 2
    Last Post: 23rd September 2009, 08:19
  2. How to merge qpixmaps in qt4.5
    By newqtuser in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2009, 14:59
  3. Q_PROPERTIES when to use it?
    By radek.z in forum Qt Programming
    Replies: 6
    Last Post: 10th February 2009, 12:26
  4. How to merge two QPixmaps in to one.
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 17th August 2008, 13:59
  5. how to merge QPixmaps
    By tommy in forum Qt Programming
    Replies: 2
    Last Post: 27th March 2008, 12:02

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
  •  
Qt is a trademark of The Qt Company.