Ahh, this will not work. And it's a little bit weird too.
You have a dialog. This dialog creates a main window when done. Then in the main window, you create the dialog again.
I suggest you do this a little bit different.
Now, Startup is a dialog where you can set settings. In your connect function, you create a Startup object called s.
Startup s;
Startup s;
To copy to clipboard, switch view to plain text mode
So far that is ok.
But in your next line, you already ask for a setting.
QString p = s.getPort();
To copy to clipboard, switch view to plain text mode
You will get the initialised version of that setting here. Do you know why?
You never show the dialog, not modeless or modal. So you never set any setting. You just created the dialog object.
I suggest you remove the creation of the main window from the dialog.
Start with the main window right away.
Then from within your main window, set some slots to receive the data like setData(server, port, username, password).
In your dialog create a signal to send the data like newData(server, port, username, password).
In your connect function (for example), you can do this:
Startup s;
connect(&s, SIGNAL(newData(server, ...)), this, SLOT(setData(server, ...)));
s.exec();
Startup s;
connect(&s, SIGNAL(newData(server, ...)), this, SLOT(setData(server, ...)));
s.exec();
To copy to clipboard, switch view to plain text mode
In your dialog slot for the done button (in your case called showMainWindow(), emit the signal.
Bookmarks