diff --git a/src/ui/scanflag.cc b/src/ui/scanflag.cc index 8a85a448..b3b33aa3 100644 --- a/src/ui/scanflag.cc +++ b/src/ui/scanflag.cc @@ -52,7 +52,11 @@ void ScanFlag::showScanFlag() QPoint currentPos = QCursor::pos(); - QRect desktop = QGuiApplication::primaryScreen()->geometry(); + auto screen = QGuiApplication::screenAt( currentPos ); + if ( !screen ) + return; + + QRect desktop = screen->geometry(); QSize windowSize = geometry().size(); diff --git a/src/ui/scanpopup.cc b/src/ui/scanpopup.cc index 5276134e..1885eaf9 100644 --- a/src/ui/scanpopup.cc +++ b/src/ui/scanpopup.cc @@ -522,7 +522,11 @@ void ScanPopup::engagePopup( bool forcePopup, bool giveFocus ) QPoint currentPos = QCursor::pos(); - QRect desktop = QGuiApplication::primaryScreen()->geometry(); + auto screen = QGuiApplication::screenAt( currentPos ); + if ( !screen ) + return; + + QRect desktop = screen->geometry(); QSize windowSize = geometry().size();