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

Shawn Rutledge Shawn.Rutledge at qt.io
Tue Apr 26 11:11:07 CEST 2016


> On 26 Apr 2016, at 10:02, Sina Dogru <sinadooru at gmail.com> wrote:
> 
> On the Widgets world, some of the static functions of QMessageBox and QFileDialog (eg getSaveFileName and warning) are so handy and necessary, IMHO. I do mimic this behaviour with a QML function, which opens a file dialog or a message box with the function arguments, connected to a signal of a C++ class. So whenever I need to interact with the user from C++ I just emit this signal with the proper arguments. For example when I need to say to user that his/her input was incorrect, I just emit warning signal. But the problem is when I need to get the user respond to this warning box. Beauty of the QMessageBox and QFileDialog's static functions are they creates their own event loop and they just returns the data that needed.

You shouldn’t need to do this.  Just write onAccepted/onRejected handlers which call back to QML and/or C++ code as necessary.  Is there some reason why that is difficult?



More information about the Interest mailing list