mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 09:51:03 +00:00
QT: Add a placeholder for the render window when it's hidden
This commit is contained in:
parent
80e9064179
commit
c753c8f905
@ -57,6 +57,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
|
|||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
statusBar()->hide();
|
statusBar()->hide();
|
||||||
|
|
||||||
|
render_window_placeholder = new QSpacerItem(400, 480, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
render_window = new GRenderWindow(this, emu_thread.get());
|
render_window = new GRenderWindow(this, emu_thread.get());
|
||||||
render_window->hide();
|
render_window->hide();
|
||||||
|
|
||||||
@ -230,6 +232,7 @@ void GMainWindow::BootGame(std::string filename) {
|
|||||||
// Update the GUI
|
// Update the GUI
|
||||||
registersWidget->OnDebugModeEntered();
|
registersWidget->OnDebugModeEntered();
|
||||||
callstackWidget->OnDebugModeEntered();
|
callstackWidget->OnDebugModeEntered();
|
||||||
|
ui.horizontalLayout->removeItem(render_window_placeholder);
|
||||||
render_window->show();
|
render_window->show();
|
||||||
|
|
||||||
OnStartGame();
|
OnStartGame();
|
||||||
@ -259,6 +262,7 @@ void GMainWindow::ShutdownGame() {
|
|||||||
ui.action_Pause->setEnabled(false);
|
ui.action_Pause->setEnabled(false);
|
||||||
ui.action_Stop->setEnabled(false);
|
ui.action_Stop->setEnabled(false);
|
||||||
render_window->hide();
|
render_window->hide();
|
||||||
|
ui.horizontalLayout->addSpacerItem(render_window_placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadFile()
|
void GMainWindow::OnMenuLoadFile()
|
||||||
@ -318,11 +322,14 @@ void GMainWindow::ToggleWindowMode() {
|
|||||||
ui.horizontalLayout->addWidget(render_window);
|
ui.horizontalLayout->addWidget(render_window);
|
||||||
if (emu_thread != nullptr)
|
if (emu_thread != nullptr)
|
||||||
render_window->setVisible(true);
|
render_window->setVisible(true);
|
||||||
|
else
|
||||||
|
ui.horizontalLayout->addSpacerItem(render_window_placeholder);
|
||||||
render_window->setFocusPolicy(Qt::ClickFocus);
|
render_window->setFocusPolicy(Qt::ClickFocus);
|
||||||
render_window->setFocus();
|
render_window->setFocus();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Render in a separate window...
|
// Render in a separate window...
|
||||||
|
ui.horizontalLayout->removeItem(render_window_placeholder);
|
||||||
ui.horizontalLayout->removeWidget(render_window);
|
ui.horizontalLayout->removeWidget(render_window);
|
||||||
render_window->setParent(nullptr);
|
render_window->setParent(nullptr);
|
||||||
if (emu_thread != nullptr)
|
if (emu_thread != nullptr)
|
||||||
|
@ -75,6 +75,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
|
||||||
|
QSpacerItem* render_window_placeholder;
|
||||||
GRenderWindow* render_window;
|
GRenderWindow* render_window;
|
||||||
|
|
||||||
std::unique_ptr<EmuThread> emu_thread;
|
std::unique_ptr<EmuThread> emu_thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user