Add a clear settings button

This commit is contained in:
spiros
2025-02-03 18:13:47 +02:00
parent 4e05d32e34
commit fb90679f6a
34 changed files with 5979 additions and 9208 deletions

View File

@@ -1297,3 +1297,20 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
onPrevButtonClicked();
}
}
void MainWindow::on_actionClear_Settings_triggered()
{
QMessageBox msgBox;
msgBox.setWindowTitle(QObject::tr("Clear Settings"));
msgBox.setText(QObject::tr("Are you sure you want to clear the settings saved on disk?"));
msgBox.setIcon(QMessageBox::Warning);
msgBox.addButton(QMessageBox::Cancel);
QPushButton *clearSettingsButton = msgBox.addButton(QMessageBox::Ok);
msgBox.exec();
if (msgBox.clickedButton() == clearSettingsButton) {
settings.clear();
}
}

View File

@@ -43,6 +43,8 @@ private slots:
void on_actionCyclic_Navigation_toggled(bool arg1);
void on_actionUse_GB_instead_of_TB_toggled(bool arg1);
void on_actionClear_Settings_triggered();
private:
Ui::MainWindow *ui;
QSettings settings;

View File

@@ -490,7 +490,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>30</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -509,6 +509,8 @@
<addaction name="actionUse_Fahrenheit"/>
<addaction name="actionCyclic_Navigation"/>
<addaction name="actionUse_GB_instead_of_TB"/>
<addaction name="separator"/>
<addaction name="actionClear_Settings"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
@@ -637,6 +639,11 @@
<string>About &amp;Qt</string>
</property>
</action>
<action name="actionClear_Settings">
<property name="text">
<string>Clear Settings</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>