[Qt-creator] Auto-completion of objects exposed to QML through setContextProperty

achartier at fastmail.fm achartier at fastmail.fm
Sun Sep 15 02:54:14 CEST 2013


Hi,

I am currently having difficulty getting auto-completion in Qt Creator
to work for a custom type I have exposed to QML through
setContextProperty. There are a couple of issues I've noticed:

(1) From my understanding, if setContextProperty is called from any file
other than main.cpp Qt Creator will not provide auto-completion for this
object. This is most apparent in the fact that the object does not show
in italicized blue text in the QML file. Doing <objectName> followed by
a dot yields no auto-completion menu at all.
(2) I have also noticed that context properties that I expose that have
custom/aggregate objects as properties which in turn expose more
properties do not get auto-completion either. For example, something
like _myObject.complexSubObject.nestedQStringProperty will yield no
auto-completion in the QML file.

I'm very much interested in this auto-completion as this set up will be
one of the primary interfaces the developers will use to access C++
objects I expose to QML. Furthermore, these objects are likely to have
potentially hundreds of properties exposed, and setting auto-completion
for such large sets would be very useful and developer-friendly.

Any help in this regard is greatly appreciated.

Thanks,

Alfonso



More information about the Qt-creator mailing list