Saved the MainWindow geometry on window close
This commit is contained in:
parent
094e2a3936
commit
582029b63c
3 changed files with 22 additions and 1 deletions
|
@ -10,6 +10,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
Q_INIT_RESOURCE( resource );
|
||||
|
||||
QCoreApplication::setOrganizationName("Telldus");
|
||||
QCoreApplication::setOrganizationDomain("www.telldus.se");
|
||||
QCoreApplication::setApplicationName("Telldus Center");
|
||||
|
||||
|
||||
TelldusCenterApplication application(argc, argv);
|
||||
|
||||
MainWindow *w = new MainWindow();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <QStatusBar>
|
||||
#include <QToolBar>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "../TelldusGui/telldusgui.h"
|
||||
|
||||
|
@ -15,6 +15,12 @@ MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
|
|||
, m_pagesBar(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
// Restore size and position
|
||||
QSettings settings;
|
||||
resize(settings.value("Size", size()).toSize());
|
||||
move(settings.value("Pos", pos()).toPoint());
|
||||
|
||||
statusBar()->setSizeGripEnabled(true);
|
||||
setupMenu();
|
||||
setupToolBar();
|
||||
|
@ -31,6 +37,13 @@ MainWindow::~MainWindow()
|
|||
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent( QCloseEvent *event ) {
|
||||
QSettings settings;
|
||||
settings.setValue("Size", size());
|
||||
settings.setValue("Pos", pos());
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::setupMenu()
|
||||
{
|
||||
menuBar()->clear();
|
||||
|
|
|
@ -13,6 +13,9 @@ public:
|
|||
MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
~MainWindow();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent *event );
|
||||
|
||||
private slots:
|
||||
void slotAboutApplication();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue