Skip to content

Commit

Permalink
fix #1168 window is white before drawing itself
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Nov 3, 2021
1 parent 6c8264b commit a72b757
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ int main(int argc, char **argv)
a.mainWindow = &MAIN;
if (!a.appDirArg.isEmpty())
a.mainWindow->hideSetDataDirectory();
#ifdef Q_OS_WIN
a.mainWindow->setProperty("windowOpacity", 0.0);
#endif
a.mainWindow->show();
a.processEvents();
a.mainWindow->setFullScreen(a.isFullScreen);
splash.finish(a.mainWindow);

Expand Down
13 changes: 12 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2641,11 +2641,22 @@ void MainWindow::showEvent(QShowEvent* event)
#endif
onAutosaveTimeout();

QTimer::singleShot(1000, this, [=]() {
QTimer::singleShot(100, this, [=]() {
Database::singleton(this);
#ifdef Q_OS_WIN
this->setProperty("windowOpacity", 1.0);
#endif
});
}

void MainWindow::hideEvent(QHideEvent* event)
{
Q_UNUSED(event)
#ifdef Q_OS_WIN
setProperty("windowOpacity", 0.0);
#endif
}

void MainWindow::on_actionOpenOther_triggered()
{
// these static are used to open dialog with previous configuration
Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class MainWindow : public QMainWindow
void dropEvent(QDropEvent*);
void closeEvent(QCloseEvent*);
void showEvent(QShowEvent*);
void hideEvent(QHideEvent* event);

private:
void setupSettingsMenu();
Expand Down

0 comments on commit a72b757

Please sign in to comment.