Results 1 to 3 of 3

Thread: How should I return data (string, int) after a QDialog is close?

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How should I return data (string, int) after a QDialog is close?

    Hi!

    How should I return data (string, int) after a QDialog is close?

    Is this correct?

    Qt Code:
    1. CNewLevelDialog dialog2(this);
    2. QString string; int number;
    3. if (dialog2.exec()==QDialog::Accepted) {
    4. string= dialog2->getstring();
    5. number= string= dialog2->getnumbre();
    6. }
    To copy to clipboard, switch view to plain text mode 

    Thanks!
    Last edited by wysota; 27th June 2009 at 20:09. Reason: missing [code] tags

  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How should I return data (string, int) after a QDialog is close?

    Quote Originally Posted by ricardo View Post
    Hi!

    How should I return data (string, int) after a QDialog is close?

    Is this correct?

    CNewLevelDialog dialog2(this);
    QString string; int number;
    if (dialog2.exec()==QDialog::Accepted) {
    string= dialog2->getstring();
    number= string= dialog2->getnumbre();
    }

    Thanks!
    dialog2 is not a pointer, use
    string= dialog2.getstring();

  3. The following user says thank you to lni for this useful post:

    ricardo (27th June 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How should I return data (string, int) after a QDialog is close?

    Quote Originally Posted by lni View Post
    dialog2 is not a pointer, use
    string= dialog2.getstring();
    OK, that's true, a tiny mistake. Thanks.

Similar Threads

  1. QDialog with Close, Maximize and Context Help Buttons
    By mclark in forum Qt Programming
    Replies: 7
    Last Post: 1st May 2020, 16:53
  2. error with QList with a class
    By john_god in forum Newbie
    Replies: 7
    Last Post: 12th January 2009, 21:48
  3. QTableView performances
    By miraks in forum Qt Programming
    Replies: 18
    Last Post: 1st December 2008, 10:25
  4. How to return a lot of data from a QDialog
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2008, 12:10
  5. QDialog not showing close button on Mac
    By manojmka in forum Qt Programming
    Replies: 2
    Last Post: 17th September 2008, 12:56

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.