Problems signalling from QML to C++

Tomaz Canabrava tcanabrava at kde.org
Tue Jan 5 08:12:49 PST 2016


On Tue, Jan 5, 2016 at 1:39 PM, Willem Ferguson <
willemferguson at zoology.up.ac.za> wrote:

> Dear Dirk, Sebastian,
>
> If it were possible to have feedback from you based on not more than 15
> minutes of your time, I would greatly appreciate it. I am trying to get the
> QML to signal to the C++ and, due to newby inexperience, I am totally
> stuck. I address a number of issues here, but the first one is the
> substantive one, the others are small. I take the liberty of attaching the
> code in three files.
>
> 1) Signalling from the Continue button in the QML to the appropriate C++
> slot. I use an approach as close as possible to that of QmlManager in
> Subsurface-mobile. I create a message object with a slot, and connect this
> to the QML signal. Using QtCreator I get a compile-time error:
> /home/willem/qml/vendor/main.cpp:48: error: undefined reference to
> `GUIMessageClass::~GUIMessageClass()'
>

This means that the GUIMessageClass ditdn't implemented a method, nothing
related to QML.

GuiMessageClass::~GuiMessageClass {
    qDebug() << "Destructor Method \o/";
}


> There is a possibility this is a systemic problem related to the way of
> presenting code to QTCreator, but I am too naïve to be able to determine
> this. Any comment at all will be invaluable.
>
> 2) In the object in the header file, what does ~MessageClass mean? It
> eliminates a compilation error for this code.
>
> 3) With respect to the two models used in the QML, I get warnings from the
> QML debugger in QtCreator:
>
> qrc:main.qml:24: ReferenceError: vendorModel is not defined
>
> qrc:main.qml:35: ReferenceError: productModel is not defined
>
> qrc:main.qml:35: ReferenceError: productModel is not defined
> These warnings do not cause faulty execution, though. But I would love to
> know how they arise.
>

This means that the  vendor and product model are not exported to QML, I
see that you are exporting them - but you are exporting them after defining
the QML file, maybe changing to before setting the main.qml would work?



> 4) When running the code within QtCreator, the combo boxes do not work
> well. They need to be clicked several times before the options are shown.
> However, if I provide models inside of QML (i.e. not using a C++ external
> source) and I run the code using qmlscene, then the combo boxes work as
> expected. So, FOR THE MOMENT I assume it is a problem in the way QtCreator
> does the QML interpretation and that the QML is likely to run as expected
> on a mobile device.
>

Qt Creator QML management is buggy.


> Kind regards,
> willem
>
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160105/a79948da/attachment-0001.html>


More information about the subsurface mailing list