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

2016-04-28 Thread Ben Lau
On 28 April 2016 at 05:02, Jérôme Godbout wrote: > >>I wrote a simple code where a timer increment an int and a text showing > that int in QML. And from that QML called a C++ function which blocks it. > > Take care, animation and rendering seem to be different thread. The Qml

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

2016-04-28 Thread Sina Dogru
2016-04-28 0:02 GMT+03:00 Jérôme Godbout : > > Take care, animation and rendering seem to be different thread. The Qml > main thread should block. Maybe I don't get it what you tried here. > > Just want to find out that what I am actually blocking by blocking the flow inside a

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

2016-04-27 Thread Jérôme Godbout
>>I wrote a simple code where a timer increment an int and a text showing that int in QML. And from that QML called a C++ function which blocks it. Take care, animation and rendering seem to be different thread. The Qml main thread should block. Maybe I don't get it what you tried here. >> How

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

2016-04-27 Thread Ben Lau
Hi Jérôme, On 26 April 2016 at 21:00, Jérôme Godbout wrote: > Hi Dmitry, > not much problems, except this is a modal way for interacting with the > user. I'm not a fan of modal (as matter of fact I hate it, you prevent your > user for copy/paste, check something from the

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

2016-04-27 Thread Sina Dogru
Seems like it is undefined behaviour to have QFileDialog without a parent. Sometimes it becomes "ApplicationModal" but sometimes "NonModal" (I experienced it with a simple code on Linux.).. Also Shawn warned that would block QML thread. So to try what is the behaviour of engine when the thread is

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

2016-04-26 Thread Jérôme Godbout
We have QWidgets as base window (QMainWindow) that have the QQuickView into it. For the parent, we use the QMainWindow. Maybe this explain why it work well in our case. We have some tools that are still into QWidgets (TreeView mostly with dock window, the Qml TreeView, is somewhat... painful in

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

2016-04-26 Thread Sina Dogru
Yes I got your points. At least there is no any bouncing between QML and C++. 2016-04-26 20:11 GMT+03:00 Jérôme Godbout : > We are mostly using QFileDialog and QMessageBox. Note the Qml type but the > one from QtWidgets/QFileDialog > > *Q_INVOKABLE QString

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

2016-04-26 Thread Jérôme Godbout
We are mostly using QFileDialog and QMessageBox. Note the Qml type but the one from QtWidgets/QFileDialog *Q_INVOKABLE QString getSaveFileName(...); // .h* *QString MySingletonDialog::getSaveFileName(...) // .cpp* *{* * return QFileDialog::getSaveFileName(...);* *}* here the return error

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

2016-04-26 Thread Sina Dogru
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 : > 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

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

2016-04-26 Thread Jérôme Godbout
Hi Dmitry, not much problems, except this is a modal way for interacting with the user. I'm not a fan of modal (as matter of fact I hate it, you prevent your user for copy/paste, check something from the real work window), but the Qml Dialog callback make it even worst. It seem ok for a single

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

2016-04-26 Thread Dmitry Volosnykh
Jérôme, thank you for your input. Just for self education... Did you face some problems with such approach which you may want to share with us? Any UI performance issues since you may have blocked scene renderer? On Tue, Apr 26, 2016 at 3:39 PM Jérôme Godbout wrote: > We

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

2016-04-26 Thread Jérôme Godbout
We also have expose those blocking C++ QMessageBox and QDialog for linear workflow via Q_INVOKABLE from C++ singleton. 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

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

2016-04-26 Thread Jérôme Godbout
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. 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

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

2016-04-26 Thread Sina Dogru
Ah yeah, thank you so much Dmitry :) 2016-04-26 13:49 GMT+03:00 Dmitry Volosnykh : > While I cannot recommend you some 'the best book on declarative > programming', I still suggest you to read http://qmlbook.github.io > > On Tue, Apr 26, 2016 at 1:27 PM Sina Dogru

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

2016-04-26 Thread Dmitry Volosnykh
While I cannot recommend you some 'the best book on declarative programming', I still suggest you to read http://qmlbook.github.io On Tue, Apr 26, 2016 at 1:27 PM Sina Dogru wrote: > Yes I guess I am still thinking procedural way. Do you have any > recommendation

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

2016-04-26 Thread Sina Dogru
Yes I guess I am still thinking procedural way. Do you have any recommendation book/documents to understand declarative programming? Thank you for your helps. Sina 2016-04-26 13:07 GMT+03:00 Dmitry Volosnykh : > > Well the problem is ... while using QFileDialog's

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

2016-04-26 Thread Dmitry Volosnykh
> FileDialog's open function would not return the file URL while QFileDialog::getSaveFileName would return it While FileDialog.open() does not return anythying, you still able to get file's URL via fileUrl property of FileDialog instance like follows: FileDialog { id: fileDialog onAccepted:

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

2016-04-26 Thread Sina Dogru
Ah by the way I just wrote this code to show my purpose. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest

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

2016-04-26 Thread Sina Dogru
2016-04-26 12:11 GMT+03:00 Shawn Rutledge : > > 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? > > Well the problem is (like I tried to explain on

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

2016-04-26 Thread Sina Dogru
> Hi, Sina. You may try to wrap those C++-side static methods with > intermediary class that is exposed to QML in a usual way. As far as I > remember there should be some API for opening files as well as for message > notifications. But that will require you to import QtQuick.Controls module. >

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

2016-04-26 Thread Shawn Rutledge
> On 26 Apr 2016, at 10:02, Sina Dogru 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 >

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

2016-04-26 Thread Dmitry Volosnykh
Hi, Sina. You may try to wrap those C++-side static methods with intermediary class that is exposed to QML in a usual way. As far as I remember there should be some API for opening files as well as for message notifications. But that will require you to import QtQuick.Controls module. Please,

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

2016-04-26 Thread Sina Dogru
Hello list, Before watching this video , I was thinking the Qt-Declarative module is aiming to touch-screen and mobile devices. And also after experiencing some QtQuick applications on desktop my thought have