1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Fix window fullscreening

Cleanup
This commit is contained in:
kelteseth 2018-09-14 15:33:28 +02:00
parent dabb814dd1
commit 63caa6f3b2

View File

@ -100,6 +100,7 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
if (!foundWorker) { if (!foundWorker) {
qDebug() << "No worker window found"; qDebug() << "No worker window found";
destroyThis();
} }
//Hide first to avoid flickering //Hide first to avoid flickering
@ -127,7 +128,7 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
connect(m_quickRenderer.data(), &QQuickView::statusChanged, [=](QQuickView::Status status) { connect(m_quickRenderer.data(), &QQuickView::statusChanged, [=](QQuickView::Status status) {
if (status == QQuickView::Error) { if (status == QQuickView::Error) {
QApplication::exit(-16); destroyThis();
} }
}); });
@ -136,10 +137,20 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
void MainWindow::init() void MainWindow::init()
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
ShowWindow(m_hwnd, SW_SHOWDEFAULT); // This needs to be set in this order or
// the window will be opened as fullscreen!
ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT);
ShowWindow(m_hwnd, SW_SHOWDEFAULT);
#endif #endif
} }
void MainWindow::destroyThis()
{
#ifdef Q_OS_WIN
ShowWindow(m_worker_hwnd, SW_HIDE);
ShowWindow(m_hwnd, SW_HIDE);
#endif
QCoreApplication::quit();
}
void MainWindow::messageReceived(QString key, QString value) void MainWindow::messageReceived(QString key, QString value)
{ {
@ -194,12 +205,3 @@ void MainWindow::messageReceived(QString key, QString value)
emit qmlSceneValueReceived(key, value); emit qmlSceneValueReceived(key, value);
} }
void MainWindow::destroyThis()
{
#ifdef Q_OS_WIN
ShowWindow(m_worker_hwnd, SW_HIDE);
ShowWindow(m_hwnd, SW_HIDE);
#endif
QCoreApplication::quit();
}