qt - Waiting for QNetworkAccessManager's response before launching GUI -
i have qt application. when executed command line can give password argument sent qnetworkaccessmanager
server check it, , reply handled qobject
. after network request sent, application launches graphical interface.
i graphical interface launch if password correct, wait action of qobject
finish.
i think can load graphical interface main.cpp
file, have check passwork in file well. qobject
have called code main.cpp
file file not class , cannot have methods.
what right way go it?
you can launch gui anywhere. example:
class app_starter : public qobject { q_object public: app_starter(qstring password) { //performing password check request here } private slots: void response() { //read response if (password_ok) { main_window* mw = new main_window(); mw->show(); } else { qapplication::quit(); } } }; //main() qapplication app; app_starter starter(app.arguments()[1]); return app.exec();
you can make launcher don't know gui:
class app_starter : public qobject { //... private slots: void response() { //read response if (password_ok) { emit password_ok(); } else { qapplication::quit(); } } signals: void password_ok(); }; //main() qapplication app; main_window window; app_starter starter(app.arguments()[1]); connect(&starter, signal(password_ok()), &window, slot(show())); return app.exec();
Comments
Post a Comment