Results 1 to 4 of 4

Thread: Creating a Custom Dialog, and Returning Multiple QString's

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a Custom Dialog, and Returning Multiple QString's

    Thank you! I didn't know that. Problem solved.

    For future reference, though, how would I use pointers with class constructors to pass data back and forth, from the class that generates the information wanted back to the caller that created the class and wants that information?

  2. #2
    Join Date
    Sep 2007
    Posts
    19
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating a Custom Dialog, and Returning Multiple QString's

    you can provide some bool flags or even status function, which will describe the child object' state.

    simple example:
    Qt Code:
    1. enum State
    2. {
    3. Idle = 0,
    4. Running,
    5. Error
    6. };
    7.  
    8. int currentState(); //returns current state from State enum
    9.  
    10. State _state; //variable for storing current state
    To copy to clipboard, switch view to plain text mode 

    then you can check child' state or even block parent object waiting for state changes.
    for example
    Qt Code:
    1. ChildObject obj;
    2. obj.run();
    3.  
    4. while(ChildObject::Running == obj.currentState)
    5. qApp->processEvents();
    6.  
    7. ...
    To copy to clipboard, switch view to plain text mode 

    and another Qt-styled solution is using signal-slot connection, which is of course the best one.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.