diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-03 14:51:12 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-03 14:51:12 -0400 |
| commit | 24aee49792c149f080eee37171ba049d0a618961 (patch) | |
| tree | 0f7ad55cde964da2afd3453b2d1a751e1ab2a462 /src | |
| parent | f00314442b9c3c28e846c64da3c3f776e50656de (diff) | |
remember the monitor number
use it to display the splash screen on the same monitor as the main window instead of where the mouse cursor is
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 11 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index c012b037..6f304944 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -597,6 +597,17 @@ int runApplication(MOApplication &application, SingleInstance &instance, QPixmap pixmap(splashPath); QSplashScreen splash(pixmap); + + if (settings.contains("window_monitor")) { + const int monitor = settings.value("window_monitor").toInt(); + + if (monitor != -1) { + QDesktopWidget* desktop = QApplication::desktop(); + const QPoint center = desktop->availableGeometry(monitor).center(); + splash.move(center - splash.rect().center()); + } + } + splash.show(); splash.activateWindow(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0ef9bc80..428c77dc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1930,6 +1930,7 @@ void MainWindow::storeSettings(QSettings &settings) { if (settings.value("reset_geometry", false).toBool()) { settings.remove("window_geometry"); settings.remove("window_split"); + settings.remove("window_monitor"); settings.remove("log_split"); settings.remove("filters_visible"); settings.remove("browser_geometry"); @@ -1938,6 +1939,7 @@ void MainWindow::storeSettings(QSettings &settings) { } else { settings.setValue("window_geometry", saveGeometry()); settings.setValue("window_split", ui->splitter->saveState()); + settings.setValue("window_monitor", QApplication::desktop()->screenNumber(this)); settings.setValue("log_split", ui->topLevelSplitter->saveState()); settings.setValue("browser_geometry", m_IntegratedBrowser.saveGeometry()); settings.setValue("filters_visible", ui->displayCategoriesBtn->isChecked()); |
