summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorBonta <40473493+Bonta0@users.noreply.github.com>2021-07-22 18:19:27 +0200
committerBonta <40473493+Bonta0@users.noreply.github.com>2021-07-24 20:00:16 +0200
commit6fc060bdca4635ffe8a48529092cd85d8912d860 (patch)
tree00ea822f7effb3b7deb6f63985980c4db5f8b0bf /Source/Core
parent501868ace0d68f54fe22c559145920abeb1d5a88 (diff)
Qt: AlwaysOnTop GBA widget option
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/GBAWidget.cpp19
-rw-r--r--Source/Core/DolphinQt/GBAWidget.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/GBAWidget.cpp b/Source/Core/DolphinQt/GBAWidget.cpp
index 289812f93c..a4a2da4231 100644
--- a/Source/Core/DolphinQt/GBAWidget.cpp
+++ b/Source/Core/DolphinQt/GBAWidget.cpp
@@ -247,6 +247,19 @@ void GBAWidget::SetBorderless(bool enable)
}
}
+bool GBAWidget::IsAlwaysOnTop() const
+{
+ return windowFlags().testFlag(Qt::WindowStaysOnTopHint);
+}
+
+void GBAWidget::SetAlwaysOnTop(bool enable)
+{
+ if (windowFlags().testFlag(Qt::WindowStaysOnTopHint) == enable)
+ return;
+ setWindowFlag(Qt::WindowStaysOnTopHint, enable);
+ show();
+}
+
void GBAWidget::UpdateTitle()
{
std::string title = fmt::format("GBA{}", m_core_info.device_number + 1);
@@ -366,6 +379,11 @@ void GBAWidget::contextMenuEvent(QContextMenuEvent* event)
borderless_action->setChecked(IsBorderless());
connect(borderless_action, &QAction::triggered, this, [this] { SetBorderless(!IsBorderless()); });
+ auto* topmost_action = new QAction(tr("Always on &Top"), options_menu);
+ topmost_action->setCheckable(true);
+ topmost_action->setChecked(IsAlwaysOnTop());
+ connect(topmost_action, &QAction::triggered, this, [this] { SetAlwaysOnTop(!IsAlwaysOnTop()); });
+
menu->addAction(disconnect_action);
menu->addSeparator();
menu->addAction(load_action);
@@ -385,6 +403,7 @@ void GBAWidget::contextMenuEvent(QContextMenuEvent* event)
options_menu->addMenu(size_menu);
options_menu->addSeparator();
options_menu->addAction(borderless_action);
+ options_menu->addAction(topmost_action);
size_menu->addAction(x1_action);
size_menu->addAction(x2_action);
diff --git a/Source/Core/DolphinQt/GBAWidget.h b/Source/Core/DolphinQt/GBAWidget.h
index 8248339766..041cb2cc12 100644
--- a/Source/Core/DolphinQt/GBAWidget.h
+++ b/Source/Core/DolphinQt/GBAWidget.h
@@ -55,6 +55,9 @@ public:
bool IsBorderless() const;
void SetBorderless(bool enable);
+ bool IsAlwaysOnTop() const;
+ void SetAlwaysOnTop(bool enable);
+
private:
void UpdateTitle();
void UpdateVolume();