We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5ba0f29 commit 5a664e4Copy full SHA for 5a664e4
preditor/gui/app.py
@@ -117,12 +117,15 @@ def root_window(cls):
117
if root_window is None:
118
windows = []
119
dialogs = []
120
- for w in inst.topLevelWidgets():
121
- if w.parent() is None:
122
- if isinstance(w, QMainWindow):
123
- windows.append(w)
124
- elif isinstance(w, QDialog):
125
- dialogs.append(w)
+
+ hasTopLevelWidgets = hasattr(QApplication.instance(), "topLevelWidgets")
+ if hasTopLevelWidgets:
+ for w in inst.topLevelWidgets():
+ if w.parent() is None:
+ if isinstance(w, QMainWindow):
126
+ windows.append(w)
127
+ elif isinstance(w, QDialog):
128
+ dialogs.append(w)
129
if windows:
130
root_window = windows[0]
131
elif dialogs:
0 commit comments