mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
save the window state only when the window was visible and the state was loaded
the problem was: the state of the windows was set to the initial state on close, when it wasn't visible. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3136 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5b1fae0123
commit
f1da09ad93
@ -36,6 +36,7 @@ RWindow::RWindow(QString name, QWidget *parent, Qt::WFlags flags)
|
|||||||
: QMainWindow(parent, flags)
|
: QMainWindow(parent, flags)
|
||||||
{
|
{
|
||||||
_name = name;
|
_name = name;
|
||||||
|
m_bSaveStateOnClose = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
@ -55,6 +56,11 @@ RWindow::setShortcut(QString shortcut, const char *slot)
|
|||||||
void
|
void
|
||||||
RWindow::saveWindowState()
|
RWindow::saveWindowState()
|
||||||
{
|
{
|
||||||
|
if (m_bSaveStateOnClose == false) {
|
||||||
|
// nothing to save
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040200
|
#if QT_VERSION >= 0x040200
|
||||||
saveSetting("Geometry", saveGeometry());
|
saveSetting("Geometry", saveGeometry());
|
||||||
#else
|
#else
|
||||||
@ -67,6 +73,8 @@ RWindow::saveWindowState()
|
|||||||
void
|
void
|
||||||
RWindow::restoreWindowState()
|
RWindow::restoreWindowState()
|
||||||
{
|
{
|
||||||
|
m_bSaveStateOnClose = true; // now we save the window state on close
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040200
|
#if QT_VERSION >= 0x040200
|
||||||
QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
|
QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
|
||||||
if (geometry.isEmpty())
|
if (geometry.isEmpty())
|
||||||
|
@ -68,6 +68,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString _name; /**< Name associated with this window. */
|
QString _name; /**< Name associated with this window. */
|
||||||
|
bool m_bSaveStateOnClose; // is set to true in restoreWindowState
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user