Skip to content

Commit

Permalink
Clean up code to give parents to QObjects.
Browse files Browse the repository at this point in the history
  • Loading branch information
madsciencecoder committed Feb 16, 2016
1 parent 22375d7 commit cf0812f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jsonworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void JsonWorker::startRequest(QUrl url)
{
QLOG_DEBUG() << "Downloading file:" << url.url();

networkManager = new QNetworkAccessManager(); //Network manager to handle downloading the JSON document
networkManager = new QNetworkAccessManager(this); //Network manager to handle downloading the JSON document

reply = networkManager->get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
Expand Down
4 changes: 2 additions & 2 deletions launcherwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ LauncherWindow::LauncherWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui
loginIsReady = false;

//Begin updating the game files
updateThread = new QThread;
UpdateWorker *updateWorker = new UpdateWorker();
updateThread = new QThread(this);
UpdateWorker *updateWorker = new UpdateWorker(this);
//make a new thread for the updating process since it can bog down the main thread and make the window unresponsive
updateWorker->moveToThread(updateThread);

Expand Down
2 changes: 1 addition & 1 deletion loginworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

LoginWorker::LoginWorker(QObject *parent) : QObject(parent)
{
timer = new QTimer();
timer = new QTimer(this);
timer->setSingleShot(true);
connect(timer, SIGNAL(timeout()), this, SLOT(timerFinished()));
}
Expand Down

0 comments on commit cf0812f

Please sign in to comment.