mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
correctly close and save the application state
This commit is contained in:
@@ -549,7 +549,7 @@ void MainWindow::setupUi()
|
||||
|
||||
|
||||
retranslateUi();
|
||||
QObject::connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit()));
|
||||
QObject::connect(fileExitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
QObject::connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen()));
|
||||
QObject::connect(fileNewAction, SIGNAL(activated()), this, SLOT(fileNew()));
|
||||
QObject::connect(fileCloseAction, SIGNAL(activated()), this, SLOT(fileClose()));
|
||||
@@ -891,12 +891,6 @@ void MainWindow::init()
|
||||
|
||||
void MainWindow::destroy()
|
||||
{
|
||||
// this should be put into the close event but for now it is ok.
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
settings.setValue("MainWindow/geometry", saveGeometry());
|
||||
settings.setValue("MainWindow/windowState", saveState());
|
||||
settings.setValue("SQLLogDock/Log", logWin->comboLogType()->currentText());
|
||||
|
||||
if (gotoValidator){
|
||||
delete gotoValidator;
|
||||
}
|
||||
@@ -1092,12 +1086,16 @@ void MainWindow::fileExit()
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
QApplication::exit( 0 );
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent( QCloseEvent * )
|
||||
void MainWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
QSettings settings(QApplication::organizationName(), g_sApplicationNameShort);
|
||||
settings.setValue("MainWindow/geometry", saveGeometry());
|
||||
settings.setValue("MainWindow/windowState", saveState());
|
||||
settings.setValue("SQLLogDock/Log", logWin->comboLogType()->currentText());
|
||||
fileExit();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::addRecord()
|
||||
|
||||
@@ -155,6 +155,9 @@ private:
|
||||
void setCurrentFile(const QString& fileName);
|
||||
void activateFields(bool enable = true);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
public slots:
|
||||
virtual void on_tree_context_menu(const QPoint & qPoint);
|
||||
virtual void on_tree_selection_changed();
|
||||
@@ -169,7 +172,6 @@ public slots:
|
||||
virtual void resetBrowser();
|
||||
virtual void fileClose();
|
||||
virtual void fileExit();
|
||||
virtual void closeEvent( QCloseEvent * );
|
||||
virtual void addRecord();
|
||||
virtual void deleteRecord();
|
||||
virtual void updateTableView( int lineToSelect );
|
||||
|
||||
Reference in New Issue
Block a user