I don't see what you are trying to achieve by this loop and application exit call that could not be achieved by simply clearing any cookies/local storage. Calling exit() possibly has side effects.
Persisting down your path, try this:
- Remove the use of exit()
- Provide your main window class with a boolean member, m_reloadMe, and a public getter
- Set the m_reloadMe and call close() instead of (ab)using exit()
- Make your main():
include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
int code = 0;
bool goAgain(false);
do
{
MainWindow w;
w.show();
code = a.exec();
goAgain = w.reloadMe()
}while(goAgain);
return code;
}
include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
int code = 0;
bool goAgain(false);
do
{
MainWindow w;
w.show();
code = a.exec();
goAgain = w.reloadMe()
}while(goAgain);
return code;
}
To copy to clipboard, switch view to plain text mode
Your on_load_complete() slot is probably connected twice; once by you, and once by the auto connection mechanism.
Your code will probably misbehave if either site redirects and the loaded url is not the same as the requested url.
Bookmarks