[Interest] [QtQuick] Interaction with user from C++

Sina Dogru sinadooru at gmail.com
Tue Apr 26 15:14:16 CEST 2016

Hello Jérôme,

I am trying to understand how you made it possible,

2016-04-26 15:39 GMT+03:00 Jérôme Godbout <jerome at bodycad.com>:

> We also have expose those blocking C++ QMessageBox and QDialog for linear
> workflow via Q_INVOKABLE from C++ singleton.

I might misunderstand, do you actually using QMessageBox with QML
application? or do you mean MessageBox QML type?

> This avoid the callback spaghetti mess of Qml Dialog and made the code
> more readable. If you have many options to offer to user in particular
> sequences of may or may not be requested, the declarative way is a
> nightmare. In fact I think we have 0 Qml Dialog into our 5 CAD
> applications, but many call to those C++ blocking dialog invoke.

> On Tue, Apr 26, 2016 at 8:34 AM, Jérôme Godbout <jerome at bodycad.com>
> wrote:
>> I can tell what we did, we made a FileSystem C++ singleton that expose
>> most file system file/url check, we made those check inside Qml javascript
>> now.
Do you mean instead of sending the user input to FileDialog and checking
this url in C++, you directly check if the file exists in QML?

> This way you can make callback and GUI logic into Qml. We expect C++
>> function to be call with valid argument all the time. Else we always return
>> error (unexpected error, since the Qml code should have validate before
>> making the call, this is a developer issue).
I am sorry, you return error from what?

Side Note: We also have experiment with throw from C++ that get evaluate
>> into Qml, it work, but it would be nice to have a proper keyword with throw
>> type to indicate this and the exception get transfer to into Q_INVOKABLE.
>> Would allow for better error handling.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160426/bb6e6a51/attachment.html>

More information about the Interest mailing list