add menu entry to reset to default settings

This commit is contained in:
Axel Kohlmeyer
2023-08-02 17:52:56 -04:00
parent 2808a78822
commit c800a2c676
3 changed files with 25 additions and 7 deletions

View File

@ -140,7 +140,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
connect(ui->actionAbout_LAMMPS_GUI, &QAction::triggered, this, &LammpsGui::about);
connect(ui->action_Help, &QAction::triggered, this, &LammpsGui::help);
connect(ui->actionLAMMPS_Manual, &QAction::triggered, this, &LammpsGui::manual);
connect(ui->actionEdit_Preferences, &QAction::triggered, this, &LammpsGui::preferences);
connect(ui->actionPreferences, &QAction::triggered, this, &LammpsGui::preferences);
connect(ui->actionDefaults, &QAction::triggered, this, &LammpsGui::defaults);
connect(ui->textEdit->document(), &QTextDocument::modificationChanged, this,
&LammpsGui::modified);
@ -619,6 +620,13 @@ void LammpsGui::manual()
QDesktopServices::openUrl(QUrl("https://docs.lammps.org/"));
}
void LammpsGui::defaults()
{
QSettings settings;
settings.clear();
settings.sync();
}
void LammpsGui::preferences()
{
Preferences prefs(&lammps);

View File

@ -76,6 +76,7 @@ private slots:
void logupdate();
void modified();
void preferences();
void defaults();
private:
Ui::LammpsGui *ui;
@ -97,8 +98,8 @@ private:
QList<QString> recent_files;
std::vector<char *> lammps_args;
};
#endif // LAMMPSGUI_H
// Local Variables:
// c-basic-offset: 4
// End:

View File

@ -33,7 +33,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>24</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -59,7 +59,8 @@
<addaction name="actionCut"/>
<addaction name="actionPaste"/>
<addaction name="separator"/>
<addaction name="actionEdit_Preferences"/>
<addaction name="actionPreferences"/>
<addaction name="actionDefaults"/>
</widget>
<widget class="QMenu" name="menu_Run">
<property name="title">
@ -180,7 +181,7 @@
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>C&amp;ut</string>
<string>Cu&amp;t</string>
</property>
<property name="statusTip">
<string>Cut Selected Text to Clipboard</string>
@ -321,13 +322,13 @@
<string>Ctrl+Shift+/</string>
</property>
</action>
<action name="actionEdit_Preferences">
<action name="actionPreferences">
<property name="icon">
<iconset theme="preferences-desktop">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>&amp;Preferences...</string>
<string>Pre&amp;ferences...</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
@ -342,6 +343,14 @@
<string>LAMMPS &amp;Manual</string>
</property>
</action>
<action name="actionDefaults">
<property name="icon">
<iconset theme="document-revert"/>
</property>
<property name="text">
<string>Reset to &amp;Defaults</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>