[Development] QAction-like API for QML

Alan Alpert 416365416c at gmail.com
Wed Dec 19 19:28:14 CET 2012


On Wed, Dec 19, 2012 at 5:17 AM, Rutledge Shawn
<Shawn.Rutledge at digia.com> wrote:
> On 19 Dec 2012, at 12:57 PM, Stephen Kelly wrote:
>> I agree. In particular, using objectName for both the name of the action and
>> automatically for part of the name of the icon seems like a bad idea to me.
>
> Well objectName has such little use that it's usually left blank, whereas it would be nice if it were not blank when you are debugging sometimes.  That's my usual use case, just to label objects for debugging.  If ID were exposed in the object, that would also suffice for debugging, and for searching for objects; then we wouldn't need objectName I guess.  That's always seemed odd to me, that id is useful for referring to objects in QML, but you can't see it at runtime, whereas objectName is visible at runtime but doesn't get used much.  If it had a broader purpose it would make more sense.

id can't be seen at runtime because it doesn't exist at runtime, only
compile time. It does not map cleanly at all to object instances at
runtime, whereas objectName obviously does, and that is why you can
never have it exposed on the object.

The common debugging purpose alone is enough reason not to try to
reuse it. I've seen applications that use objectName all over their
code, and leave it in their code, just for automated testing. There's
no reason to make that harder.

--
Alan Alpert



More information about the Development mailing list