Saturday 15 March 2014

javascript - Wait for two buttons to be clicked in QML interface -


I'm disappointed again. I've added a QML interface for an existing QT C ++ application. I want to implement something like this:

The user wants to connect to images so that they leave synchronization so that they "connect" Clicks on a button, then on the first picture and then on the second picture. The signs of the buttons come with an ID, so the connect function knows which image was clicked and sends the last signal for the C + + part.

I want something like this:

  signal connect gallery (int id1, int id2) function connectIDs () {var id1 var id2 id1 = waitFor (onButtonClicked ( Id)) Id2 = waitFor (onButtonClicked (id)) saveConnection (id1, id2)} onConnectClicked: connectIDs ()   

So, anyone has an idea how to solve it?

Thanks a lot!

As far as I know, you do not have a 'wait' method like this because You must complete your code for Event Loop at connectIDs , and be able to do anything in your GUI (including selecting pictures).

The solution is "software mode", and when you click on connect , you change the mode, for example connectMode , and Return Now, when you click on a photo, you can check whether the mode is connectMode , and mark it as chosen. If another picture is already selected, then you call in connectFinished () , whatever you have to do to connect to them, then software will be able to change the code to normalMode .

No comments:

Post a Comment