[Interest] Overloading methods used by properties

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Thu Nov 3 09:03:16 CET 2011


I have a class with a property

Q_PROPERTY(QPixmap Pixmap READ pixmap WRITE setPixmap)

For convenience, I would like to allow the user of that class to specify
either a QPixmap, or a QString with a filename or resource name.

So, I declare two setters:

    void setPixmap(QPixmap arg);
    void setPixmap(QString arg);

Can this silently hurt me? The property should know which type to use,
but since it's based on QVariant, will the compiler know which setter to
call?

Going further, was overloading considered in the design of the property
system, or must each property have a single type?

Kind regards

Robert Schimkowitsch

#####################################################################################
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
Thank You.
  ANDRITZ HYDRO GmbH
  Rechtsform/ Legal form: Gesellschaft mit beschrankter Haftung / Corporation 
  Firmensitz/ Registered seat: Wien 
  Firmenbuchgericht/ Court of registry: Handelsgericht Wien 
  Firmenbuchnummer/ Company registration: FN 61833 g
  DVR: 0605077 
  UID-Nr.: ATU14756806
#####################################################################################

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20111103/0831c9fb/attachment.html>


More information about the Interest mailing list