[Development] isValid() as a property

Tony Van Eerd tvaneerd at blackberry.com
Fri Nov 29 20:23:43 CET 2013


Oh, the other thing I wanted to mention:

in the cases I am looking at, if isValid() == false, then all the other properties are invalid, and return "", -1, etc.  It really does mean the whole object is invalid.
(except maybe an 'id', in the case of, say, a Battery object - the id telling you which battery, and then isValid() saying that battery doesn't (currently) exist.)

ie it means isValid() in the same sense as all the other uses of isValid() in Qt classes.  That's why I was leaning towards the same name.  Although, yes, I was considering a different name per class, more context specific.


From: Hausmann Simon [mailto:Simon.Hausmann at digia.com]
Sent: Friday, November 29, 2013 2:20 PM
To: Tony Van Eerd; development at qt-project.org
Subject: SV: [Development] isValid() as a property

Imho isValid is fine, but generally I would suggest a more context specific name, i.e. locationKnown for example.

Think about how much sense "valid" makes in the context of the caller code and see of you can find a better name perhaps.

Simon

Fra: Tony Van Eerd
Sendt: 20:16 fredag 29. november 2013
Til: development at qt-project.org
Emne: [Development] isValid() as a property


Is it common/uncommon/unheard-of to have a 'valid' property:

Q_PROPERTY( bool valid READ isValid NOTIFY validChanged )


I'm thinking about classes like 'DeviceLocation' which would update with GPS changes, but at some point might just become invalid (or start invalid, until GPS turns on, etc).


So should isValid() only be used for 'typical' cases of, like default-constructed value-types, or is it fine as a property?

Thoughts?
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131129/e08c6376/attachment.html>


More information about the Development mailing list