Skip to content

Commit

Permalink
Implement window always on top
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed Oct 11, 2020
1 parent a55bb39 commit c2f36d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1757,4 +1757,14 @@ void MainWindow::initViewMenu()
connect(m_ui->actionShowPreviewPanel, &QAction::toggled, this, [](bool checked) {
config()->set(Config::GUI_HidePreviewPanel, !checked);
});

connect(m_ui->actionAlwaysOnTop, &QAction::toggled, this, [this](bool checked) {
if (checked) {
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
} else {
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
}
show();
});

}
12 changes: 12 additions & 0 deletions src/gui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
</widget>
<addaction name="menuTheme"/>
<addaction name="actionCompactMode"/>
<addaction name="actionAlwaysOnTop"/>
<addaction name="actionShowPreviewPanel"/>
<addaction name="actionShowToolbar"/>
</widget>
Expand Down Expand Up @@ -972,6 +973,17 @@
<string>Show Preview Panel</string>
</property>
</action>
<action name="actionAlwaysOnTop">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Always on Top</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+A</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit c2f36d8

Please sign in to comment.