Save/restore the window position.

This commit is contained in:
Dave Page 2013-10-04 10:08:18 -04:00
parent 2d8f6481dc
commit 7a066ec4b2
3 changed files with 23 additions and 0 deletions

View File

@ -42,6 +42,11 @@ BrowserWindow::BrowserWindow()
setCentralWidget(webView);
connect(webView, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
// Restore the geometry
QSettings settings;
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
// Display the app
m_initialload = true;
m_loadattempt = 1;
@ -49,6 +54,16 @@ BrowserWindow::BrowserWindow()
}
// Save the window geometry on close
void BrowserWindow::closeEvent(QCloseEvent *event)
{
QSettings settings;
settings.setValue("geometry", saveGeometry());
settings.setValue("windowState", saveState());
QMainWindow::closeEvent(event);
}
// Create the actions for the window
void BrowserWindow::createActions()
{

View File

@ -36,6 +36,9 @@ class BrowserWindow : public QMainWindow
public:
BrowserWindow();
protected:
void closeEvent(QCloseEvent *event);
protected slots:
void finishLoading(bool);

View File

@ -33,6 +33,11 @@ int main(int argc, char * argv[])
// Create the QT application
QApplication app(argc, argv);
// Setup the settings management
QCoreApplication::setOrganizationName("pgAdmin Development Team");
QCoreApplication::setOrganizationDomain("pgadmin.org");
QCoreApplication::setApplicationName(PGA_APP_NAME);
// Fire up the webserver
// TODO: Find an unused port number to use
Server *server = new Server();