[Qt5-feedback] C++ api to use for UI in addition to QML
Kishore
kitts.mailinglists at gmail.com
Tue May 17 15:45:10 CEST 2011
On Tuesday 17 May 2011 4:17:03 PM Andre Somers wrote:
> > You can't find an item by id from C++, it's a detail internal to the QML
> > engine. ObjectName will continue to work in Qt 5 though.
>
> IMO, you should be able to do just that. I know you are not able to do
> that right now, but I think that should be fixed. id's are the way you
> reference objects in QML. You give objects an id, an then do stuff on
> them. That is hardly an "internal detail". It simply doesn't make sense to
> ask people to also set the ObjectName property in order to be able to
> access the same object from C++. It doesn't add to readability either. Why
> isn't the id simply assigned as the object name by default? "Code less,
> Create more" remember?
IIRC id used for an object can only be referenced from within the same qml
file. Hence id need only be unique within a single qml file.
IMHO this characteristic of qml makes it inappropriate to use for referencing
from c++.
--
Cheers!
Kishore
More information about the Qt5-feedback
mailing list