Handle disappearing displays correctly

Qt  makes sure  a widget's  window is  displayed on  a display  if the
display configuration  changes while  it is  running.  If  the display
configuration changes while  the application is not  running then only
QWidget::saveGeometry()  and  QWidget::restoreGeometry()  will  ensure
that  the  widget's window  is  correctly  displayed if  the  original
display is no longer present.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6257 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-12-10 14:15:43 +00:00
parent 56a58fe6ab
commit 7cf8e82faf
2 changed files with 4 additions and 7 deletions

View File

@ -1116,8 +1116,7 @@ void Configuration::impl::done (int r)
{ {
// do this here since window is still on screen at this point // do this here since window is still on screen at this point
SettingsGroup g {settings_, "Configuration"}; SettingsGroup g {settings_, "Configuration"};
settings_->setValue ("window/size", size ()); settings_->setValue ("window/geometry", saveGeometry ());
settings_->setValue ("window/pos", pos ());
QDialog::done (r); QDialog::done (r);
} }
@ -1125,9 +1124,7 @@ void Configuration::impl::done (int r)
void Configuration::impl::read_settings () void Configuration::impl::read_settings ()
{ {
SettingsGroup g {settings_, "Configuration"}; SettingsGroup g {settings_, "Configuration"};
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
resize (settings_->value ("window/size", size ()).toSize ());
move (settings_->value ("window/pos", pos ()).toPoint ());
my_callsign_ = settings_->value ("MyCall", "").toString (); my_callsign_ = settings_->value ("MyCall", "").toString ();
my_grid_ = settings_->value ("MyGrid", "").toString (); my_grid_ = settings_->value ("MyGrid", "").toString ();

View File

@ -30,14 +30,14 @@ void MessageAveraging::closeEvent (QCloseEvent * e)
void MessageAveraging::read_settings () void MessageAveraging::read_settings ()
{ {
settings_->beginGroup ("MessageAveraging"); settings_->beginGroup ("MessageAveraging");
move (settings_->value ("window/pos", pos ()).toPoint ()); restoreGeometry (settings_->value ("window/geometry").toByteArray ());
settings_->endGroup (); settings_->endGroup ();
} }
void MessageAveraging::write_settings () void MessageAveraging::write_settings ()
{ {
settings_->beginGroup ("MessageAveraging"); settings_->beginGroup ("MessageAveraging");
settings_->setValue ("window/pos", pos ()); settings_->setValue ("window/geometry", saveGeometry ());
settings_->endGroup (); settings_->endGroup ();
} }