Qt: show mouse in fullscreen

This commit is contained in:
Megamouse 2020-04-14 17:35:31 +02:00
parent fc68c508c8
commit 2b69a68ef6
6 changed files with 25 additions and 8 deletions

View File

@ -43,6 +43,7 @@ gs_frame::gs_frame(const QRect& geometry, const QIcon& appIcon, const std::share
: QWindow(), m_gui_settings(gui_settings)
{
m_disable_mouse = gui_settings->GetValue(gui::gs_disableMouse).toBool();
m_show_mouse_in_fullscreen = gui_settings->GetValue(gui::gs_showMouseFs).toBool();
m_window_title = qstr(Emu.GetFormattedTitle(0));
@ -410,7 +411,7 @@ void gs_frame::mouseDoubleClickEvent(QMouseEvent* ev)
void gs_frame::HandleCursor(QWindow::Visibility visibility)
{
if (visibility == QWindow::Visibility::FullScreen)
if (visibility == QWindow::Visibility::FullScreen && !m_show_mouse_in_fullscreen)
{
setCursor(Qt::BlankCursor);
}

View File

@ -32,7 +32,8 @@ private:
u64 m_frames = 0;
QString m_window_title;
bool m_disable_mouse;
bool m_disable_mouse = false;
bool m_show_mouse_in_fullscreen = false;
public:
gs_frame(const QRect& geometry, const QIcon& appIcon, const std::shared_ptr<gui_settings>& gui_settings);

View File

@ -191,10 +191,11 @@ namespace gui
const gui_save m_discordState = gui_save(meta, "discordState", "");
const gui_save m_check_upd_start = gui_save(meta, "checkUpdateStart", true);
const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false);
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
const gui_save gs_width = gui_save(gs_frame, "width", 1280);
const gui_save gs_height = gui_save(gs_frame, "height", 720);
const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false);
const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false);
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
const gui_save gs_width = gui_save(gs_frame, "width", 1280);
const gui_save gs_height = gui_save(gs_frame, "height", 720);
const gui_save tr_icon_color = gui_save(trophy, "icon_color", gl_icon_color);
const gui_save tr_icon_height = gui_save(trophy, "icon_height", 75);

View File

@ -1264,15 +1264,21 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
if (!game)
{
SubscribeTooltip(ui->gs_resizeOnBoot, tooltips.settings.resize_on_boot);
SubscribeTooltip(ui->gs_disableMouse, tooltips.settings.disable_mouse);
SubscribeTooltip(ui->gs_showMouseInFullscreen, tooltips.settings.show_mouse_in_fullscreen);
ui->gs_disableMouse->setChecked(m_gui_settings->GetValue(gui::gs_disableMouse).toBool());
connect(ui->gs_disableMouse, &QCheckBox::clicked, [=, this](bool val)
connect(ui->gs_disableMouse, &QCheckBox::clicked, [this](bool val)
{
m_gui_settings->SetValue(gui::gs_disableMouse, val);
});
ui->gs_showMouseInFullscreen->setChecked(m_gui_settings->GetValue(gui::gs_showMouseFs).toBool());
connect(ui->gs_showMouseInFullscreen, &QCheckBox::clicked, [this](bool val)
{
m_gui_settings->SetValue(gui::gs_showMouseFs, val);
});
const bool enable_buttons = m_gui_settings->GetValue(gui::gs_resize).toBool();
ui->gs_resizeOnBoot->setChecked(enable_buttons);
ui->gs_width->setEnabled(enable_buttons);

View File

@ -2338,6 +2338,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="gs_showMouseInFullscreen">
<property name="text">
<string>Show mouse cursor in Fullscreen </string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="gs_resizeOnBoot">
<property name="text">

View File

@ -104,6 +104,7 @@ public:
const QString show_trophy_popups = tr("Show trophy pop-ups when a trophy is unlocked.");
const QString disable_mouse = tr("Disables the activation of fullscreen mode per double-click while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR).");
const QString max_llvm_threads = tr("Limits the maximum number of threads used for the initial PPU and SPU module compilation.\nLower this in order to increase performance of other open applications.\nThe default uses all available threads.");
const QString show_mouse_in_fullscreen = tr("Shows the mouse cursor when the fullscreen mode is active.\nCurrently this may not work every time.");
const QString show_shader_compilation_hint = tr("Show shader compilation hints using the native overlay.");
const QString use_native_interface = tr("Enables use of native HUD within the game window that can interact with game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nCurrently, the on-screen keyboard only supports the English key layout.");