×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    How to "freeze" code execution in "onClicked" slot?

    Hey all! I have such problem. I have a dialog and some buttons on it. One of these buttons is "delete". I want to ask user whether he really wants to delete data. So I decided to do a message box with 2 buttons: "yes" and "no". So, i made a dialog, put these buttons on it. I made a "dialog hider" with defined mouse area (to disable all clicks except my message box - so it became modal).

    In "onClicked:" slot of my "delete button" i show a dialog hider, then i show a message box. This is all clear. But i don't know what to do next. Because code, listed after showing of message box, must be executed only after user presses "yes" or "no" button. I tried to like this:
    Code:
    MessageBoxQuestion {
    		id: msgQuestion
    .......
    }
    .....
    SimpleButton {
            ....
            onClicked: {
                dialogHider.state = "show"
                msgQuestion.state = "show"
                msgQuestion.onPushedYes: {/*delete data*/}
    .....
           }
    .....
    }
    but it's not working because of "msgQuestion.onPushedYes:". I suppose properties won't also help me..... So could you give me an advise, what to do next and how to solve my problem?

    Thank you very much!

  2. #2
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    Re: How to "freeze" code execution in "onClicked" slot?

    So does anybody know, whether there is a way to create MessageBox with its normal behavior? I mean how to make it waiting for user reaction? Or it can't be done in qml?

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: How to "freeze" code execution in "onClicked" slot?

    There is some kind of Dialog in thsi code that might help you.

    http://doc.qt.nokia.com/4.7-snapshot...scene-qml.html

  4. #4
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    Re: How to "freeze" code execution in "onClicked" slot?

    Yeah, thanks! There is a dialog.. But it is like popup and there is no need to wait a user reaction.... So it is not that thing what i need ((

  5. #5
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: How to "freeze" code execution in "onClicked" slot?

    you can emit some signal on Yes/No button and can catch those signals to resolve the issue.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  6. #6
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    Re: How to "freeze" code execution in "onClicked" slot?

    I've already tried to do so... But i don't understand how to make it working:
    Code:
    //file MessageBoxQuestion
    Rectangle {
    		signal pushedYes
    		signal pushedNo
    .......
    		//has 2 buttons and when they are clicked, then these 2 signals are emitted
    }
    
    //file my dialog
    Rectangle {
    	id: listDialog
    
    	MessageBoxQuestion {
    		id: msgQuestion
    	}
    ....
    	SimpleButton {
    		id: deleteData
            	....
            	onClicked: {
                		msgQuestion.state = "show"
    			msgQuestion.onPushedYes: {
    				//delete data
    			}
    			msgQuestion.onPushedNo: {
    				//do nothing
    			}
    .....
           }
    .....
    }
    I tried this way, but it is not working because it is forbidden to write msgQuestion.onPushedYes: in onClicked of SimpleButton..

  7. #7
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: How to "freeze" code execution in "onClicked" slot?

    try like this..

    //file MessageBoxQuestion
    Rectangle {
    signal pushedYes
    signal pushedNo
    .......
    //has 2 buttons and when they are clicked, then these 2 signals are emitted
    }

    ---------------------------------------------

    MessageBoxQuestion {
    id: msgQuestion
    onPushedYesClicked:
    {
    }
    onPushedNoClicked:
    {
    }

    }
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  8. #8
    Registered User
    Join Date
    Jan 2011
    Location
    Russia, Saint-Petersburg
    Posts
    38

    Re: How to "freeze" code execution in "onClicked" slot?

    Ok, but how then i will know, from which place of my code this message box was shown? I mean if i have more than 1 place where i show this message box, how can i find out, that it was shown from "place 1", but not from "place 2"? Should i create a single message box for every question? Or should i create something like enumeration in messageBox. And in place, where i want to show this message box, i should set "enum param" to a some value, and in for example onPushedYesClicked slot i should check this param? What is the best way?

    Thanks!

Similar Threads

  1. How to replace "Exit" with "Back" in Menu
    By rahul.kulshreshtha in forum Qt
    Replies: 5
    Last Post: 2010-09-28, 08:29
  2. Is there a way to "edit" and "save" the "texts" of received SMS messages?
    By pamir_yasti in forum General Development Questions
    Replies: 1
    Last Post: 2010-07-16, 10:15
  3. Replies: 3
    Last Post: 2009-06-18, 21:42
  4. How can i use the "CMsvEntry", "TMsvEntry", "CImSmtpSettings"?
    By GFYsweetwood in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-03-12, 07:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×