Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions UM/Qt/QtApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def isShuttingDown(self) -> bool:
return self._is_shutting_down

def registerObjects(self, engine) -> None: #type: ignore #Don't type engine, because the type depends on the platform you're running on so it always gives an error somewhere.
engine.rootContext().setContextProperty("QtApplication", self)
engine.rootContext().setContextProperty("PluginRegistry", PluginRegistry.getInstance())

def makeRenderer(self) -> QtRenderer:
Expand All @@ -468,8 +469,6 @@ def getRenderer(self) -> QtRenderer:

return cast(QtRenderer, self._renderer)

mainWindowChanged = Signal()

def getMainWindow(self) -> Optional[MainWindow]:
return self._main_window

Expand All @@ -483,6 +482,9 @@ def setMainWindow(self, window: MainWindow) -> None:
self._main_window.windowStateChanged.connect(self._onMainWindowStateChanged)
self.mainWindowChanged.emit()

mainWindowChanged = Signal()
mainWindow = pyqtProperty(QQuickWindow, fget=getMainWindow, constant=True)
Comment thread
wawanbreton marked this conversation as resolved.
Resolved

def setVisible(self, visible: bool) -> None:
if self._main_window is not None:
self._main_window.visible = visible
Expand Down Expand Up @@ -614,7 +616,6 @@ def createQmlSubWindow(self, qml_file_path: str, context_properties: Dict[str, "
Create a QML window from a QML file. This method uses createQmlComponent internally, but adds a few specific
features for windows management:
* The created object is a QQuickWindow instance
* The transient parent of the window is explicitly set to be the main window
* The window ownership is handled and it will be destroyed as soon as it's no longer visible,
so the caller should not keep a reference to it
:param qml_file_path: The absolute file path to the root qml file.
Expand All @@ -626,9 +627,7 @@ def createQmlSubWindow(self, qml_file_path: str, context_properties: Dict[str, "
if result is None:
return None

result.setTransientParent(self._main_window)

# Keep a link to the window so that it is not garbage-collected, then register it for destruction
# Keep a link to the window so that it is not garbage-collected, then register it for destruction.
self._sub_windows.append(result)
result.visibleChanged.connect(self._onWindowVisibleChange, Qt.ConnectionType.QueuedConnection)

Expand Down
3 changes: 2 additions & 1 deletion UM/Qt/qml/UM/Dialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ Window
minimumHeight: screenScaleFactor * 480;
width: minimumWidth
height: minimumHeight
transientParent: QtApplication.mainWindow

property int margin: UM.Theme.getSize("default_margin").width
property bool closeOnAccept: true; // Automatically close the window when the window is "accepted" (eg using the return key)
property bool selfDestroy: false; // Automatically destroys the dialog when it has been hidden, useful if it has been created with component.createObject

default property alias contents: contentItem.children;
default property alias contents: contentItem.data;

property alias loader: contentLoader

Expand Down
6 changes: 4 additions & 2 deletions conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,12 @@ pip_requirements_core:

pip_requirements_dev:
any_os:
pytest: {}
pytest:
version: "9.1.1"
twisted:
version: "21.2.0"
pytest-benchmark: {}
pytest-benchmark:
version: "5.3.0"
sip: {}

python_translation_source_folders:
Expand Down
Loading