From 9f7682c3cd103379af2916ef83e4a24010ae67c4 Mon Sep 17 00:00:00 2001 From: ubbo Date: Sun, 7 Feb 2010 17:16:29 +0000 Subject: experiment with QSettings, store & restore size and location of mainwindow, save settings to appplication path git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@272 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgwin.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gpgwin.cpp') diff --git a/gpgwin.cpp b/gpgwin.cpp index 18cffde..4087050 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -54,6 +54,14 @@ GpgWin::GpgWin() setToolButtonStyle(Qt::ToolButtonTextUnderIcon); setIconSize(QSize(32, 32)); setCurrentFile(""); + + // Restore window size & location + // TODO: is this a good idea for a portable app? screen size & resolution may vary + QSettings settings; + QPoint pos = settings.value("pos", QPoint(100, 100)).toPoint(); + QSize size = settings.value("size", QSize(800, 450)).toSize(); + resize(size); + move(pos); //mKeyList->addMenuAction(deleteSelectedKeysAct); mKeyList->addMenuAction(appendSelectedKeysAct); @@ -261,6 +269,10 @@ void GpgWin::closeEvent(QCloseEvent *event) } else { event->ignore(); } + + QSettings settings; + settings.setValue("pos", pos()); + settings.setValue("size", size()); } void GpgWin::open() -- cgit v1.2.3