Skip to content

Commit

Permalink
Fix non-maximized state when switch on-top.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rotter committed Apr 18, 2018
1 parent c9f079b commit 744fa38
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/saurus/gui/dialogs/formmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,26 @@ void FormMain::switchVisibility(bool force_hide) {

void FormMain::switchStayOnTop() {
bool enable = (windowFlags() & Qt::WindowStaysOnTopHint) == 0;
bool was_maximized = isMaximized();
QRect geom;

if (was_maximized) {
showNormal();
qApp->processEvents();

// We store unmaximized geometry.
geom = geometry();
}

setWindowFlag(Qt::WindowStaysOnTopHint, enable);
show();

if (was_maximized) {
setGeometry(geom);
qApp->processEvents();
showMaximized();
}

m_ui.m_actionStayOnTop->setChecked(enable);
qApp->settings()->setValue(GROUP(GUI), GUI::StayOnTop, enable);
}
Expand Down

0 comments on commit 744fa38

Please sign in to comment.