Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connected helper "closeTask" to signal "aboutToQuit" so that settings… #18

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/mymainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private slots:
void on_langCB_currentIndexChanged(const int &lang);
void showStatusMessage(QString msg);
void retranslate();
void closeTask();

private:
void init();
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <QApplication>
#include <QObject>

#include "mymainwindow.h"

Expand All @@ -9,5 +10,6 @@ int main(int argc, char *argv[])
MyMainWindow w;
w.show();

QObject::connect(&a, SIGNAL(aboutToQuit()), &w, SLOT(closeTask()));
return a.exec();
}
5 changes: 5 additions & 0 deletions src/mymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ void MyMainWindow::closeEvent(QCloseEvent * event)
event->accept();
}

void MyMainWindow::closeTask()
{
saveSettings();
}

/// Laden der gespeicherten Einstellungen aller Tabs
void MyMainWindow::loadSettings()
{
Expand Down