You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
2 years ago
|
From 703db225dfa722af66e330547a3353238e76ec38 Mon Sep 17 00:00:00 2001
|
||
|
From: Palo Kisa <palo.kisa@gmail.com>
|
||
|
Date: Wed, 27 Apr 2022 08:27:06 +0200
|
||
|
Subject: [PATCH] dialog: Force correct position after move from outside
|
||
|
|
||
|
..of application.
|
||
|
|
||
|
For some reason the dialog gets repositioned by "outer world" (VM?) to
|
||
|
wrong position (0,0). The root cause of this move is yet unknown and
|
||
|
this is a workaround to avoid wong position of the window.
|
||
|
---
|
||
|
dialog.cpp | 14 ++++++++++++++
|
||
|
dialog.h | 1 +
|
||
|
2 files changed, 15 insertions(+)
|
||
|
|
||
|
diff --git a/dialog.cpp b/dialog.cpp
|
||
|
index 7164c65..5667817 100644
|
||
|
--- a/dialog.cpp
|
||
|
+++ b/dialog.cpp
|
||
|
@@ -183,6 +183,20 @@ void Dialog::resizeEvent(QResizeEvent *event)
|
||
|
}
|
||
|
|
||
|
|
||
|
+/************************************************
|
||
|
+
|
||
|
+ ************************************************/
|
||
|
+void Dialog::moveEvent(QMoveEvent *event)
|
||
|
+{
|
||
|
+ // Note: For some reason the dialog gets repositioned by "outer world" (VM?) to
|
||
|
+ // wrong position (0,0). The root cause of this move is yet unknown and
|
||
|
+ // this is a workaround to avoid wong position of the window.
|
||
|
+ if (event->spontaneous())
|
||
|
+ QTimer::singleShot(0, this, &Dialog::realign);
|
||
|
+ return QDialog::moveEvent(event);
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
/************************************************
|
||
|
|
||
|
************************************************/
|
||
|
diff --git a/dialog.h b/dialog.h
|
||
|
index 0ca29bf..a71dd3d 100644
|
||
|
--- a/dialog.h
|
||
|
+++ b/dialog.h
|
||
|
@@ -64,6 +64,7 @@ class Dialog : public QDialog
|
||
|
protected:
|
||
|
void closeEvent(QCloseEvent *event);
|
||
|
void resizeEvent(QResizeEvent *event);
|
||
|
+ void moveEvent(QMoveEvent *event);
|
||
|
bool eventFilter(QObject *object, QEvent *event);
|
||
|
bool editKeyPressEvent(QKeyEvent *event);
|
||
|
bool listKeyPressEvent(QKeyEvent *event);
|