Use dialogParent() instead of mainWindow()

There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-06-02 09:10:40 +02:00
parent 26d46fc19d
commit 5b364de168
82 changed files with 239 additions and 211 deletions

View File

@@ -483,7 +483,11 @@ public:
if (parentWidget()) {
// We are currently within a text editor tooltip:
// Rip out of parent widget and re-show as a tooltip
ToolTip::pinToolTip(this, ICore::mainWindow());
// Find parent with different window than the tooltip itself:
QWidget *top = parentWidget();
while (top->window() == window() && top->parentWidget())
top = top->parentWidget();
ToolTip::pinToolTip(this, top->window());
} else {
// We have just be restored from session data.
setWindowFlags(Qt::ToolTip);