QT: Add a placeholder for the render window when it's hidden

This commit is contained in:
Sean Maas 2015-05-28 16:12:10 -04:00
parent 80e9064179
commit c753c8f905
2 changed files with 8 additions and 0 deletions

View File

@ -57,6 +57,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
ui.setupUi(this);
statusBar()->hide();
render_window_placeholder = new QSpacerItem(400, 480, QSizePolicy::Fixed, QSizePolicy::Fixed);
render_window = new GRenderWindow(this, emu_thread.get());
render_window->hide();
@ -230,6 +232,7 @@ void GMainWindow::BootGame(std::string filename) {
// Update the GUI
registersWidget->OnDebugModeEntered();
callstackWidget->OnDebugModeEntered();
ui.horizontalLayout->removeItem(render_window_placeholder);
render_window->show();
OnStartGame();
@ -259,6 +262,7 @@ void GMainWindow::ShutdownGame() {
ui.action_Pause->setEnabled(false);
ui.action_Stop->setEnabled(false);
render_window->hide();
ui.horizontalLayout->addSpacerItem(render_window_placeholder);
}
void GMainWindow::OnMenuLoadFile()
@ -318,11 +322,14 @@ void GMainWindow::ToggleWindowMode() {
ui.horizontalLayout->addWidget(render_window);
if (emu_thread != nullptr)
render_window->setVisible(true);
else
ui.horizontalLayout->addSpacerItem(render_window_placeholder);
render_window->setFocusPolicy(Qt::ClickFocus);
render_window->setFocus();
} else {
// Render in a separate window...
ui.horizontalLayout->removeItem(render_window_placeholder);
ui.horizontalLayout->removeWidget(render_window);
render_window->setParent(nullptr);
if (emu_thread != nullptr)

View File

@ -75,6 +75,7 @@ private slots:
private:
Ui::MainWindow ui;
QSpacerItem* render_window_placeholder;
GRenderWindow* render_window;
std::unique_ptr<EmuThread> emu_thread;