[Interest] Issues with QML binding

Nibedit Dey nibedit.dev at gmail.com
Tue Jul 27 17:50:29 CEST 2021


Dear All,

I recently came across a strange issue related to QML binding.
The issue is not reproducible often which makes it difficult to find the
root cause.

Sample QML code:
Case 1: *text : "Retrieved details"+ backendCPP.getStringData()
 //Sometimes, the complete string is empty*
*Case 2: property string someString : backendCPP.getStringData()*
*text: **"Retrieved details:"+** someString // Displays **Retrieved details:
value remains empty*

99% time, the value is fetched and displayed properly in Text element.
Rarely, it remains empty.
Here backendCPP is a C++ instance exposed through context property and
an invokable method is used to fetch data. Notify signal is not used in
this case.
I believe during failure cases the data is not retrieved from backendCPP,
when binding happened due to delay in the invokable method. Is my
assumption correct?
Although we can handle the issue in multiple ways including using a NOTIFY
signal or using Qt.binding, I am curious if anyone has observed this issue.
Please share your inputs.

Thanks & Regards,
Nibedit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210727/661314fc/attachment.html>


More information about the Interest mailing list