You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.
On Mac OS X, I was unable to get the floating window to always stay on top of Nuke. If you click in the main Nuke window, the floating window would disappear behind the main Nuke window.
I reached out to the Foundry:
I'm creating a simple window with PySide and I parent it to the main Nuke application. In Windows this window will always stay on top of Nuke even if I click the main Nuke window.
In OS X however (and I assume perhaps also on Linux), if I click the Nuke window, my PySide window disappears behind Nuke. Why is that and can that be fixed?
Please note, I wish to keep the fullscreen/maximize/minimize window controls, so I'm not interested in setting the window flags to either Qt.Tool or Qt.WindowStaysOnTopHint.
Regards,
Fredrik
fromPySideimportQtGui, QtCoreclassBoilerplate(QtGui.QMainWindow):
def__init__(self, parent=None):
super(Boilerplate, self).__init__(parent)
# Set object name and window titleself.setObjectName('hello')
self.setWindowTitle('hello world!')
# Window type (I don't want Qt.Tool)self.setWindowFlags(QtCore.Qt.Window)
# Set the main widgetself.main_widget=QtGui.QLabel('Hello world!')
self.setCentralWidget(self.main_widget)
def_nuke_main_window():
"""Returns Nuke's main window"""forobjinQtGui.qApp.topLevelWidgets():
if (obj.inherits('QMainWindow') andobj.metaObject().className() =='Foundry::UI::DockMainWindow'):
returnobjelse:
raiseRuntimeError('Could not find DockMainWindow instance')
my_window=Boilerplate(parent=_nuke_main_window())
my_window.show() # Show the UI
This was the response from The Foundry:
This is really difficult to solve unfortunately. The Qt documentation for QWidget says that parenting a window to another will make it float above the other window, but the documentation is wrong and the behaviour is dependent on the window management policy for your platform. Having a floating window which doesn't get hidden when the application goes to the background is deemed un-Mac-like behaviour and not allowed. The only ways to get windows to float are to use Qt.Tool or Qt.WindowStaysOnTopHint which both have problems. In particular, Qt.WindowStaysOnTopHint makes the window stay on top of all windows even when the application is in the background. Nuke gets round this problem by manipulating the Qt.WindowStaysOnTopHint during application activation and deactivation, but to do this correctly requires writing Objective-C code and can't be done from Python (the equivalent Qt events don't get delivered at the correct time for this).
Possible solutions are:
Use Qt.Tool (I know this has already been dismissed, but it's here for completeness. Nuke does make sure that Qt.Tool windows don't get hidden when the application is deactivated, but you do lose the maximize/minimize buttons
Use the Nuke APIs to register the window as a panel, This will allow the window to be docked but also make it float correctly. I'm not sure if it solves the maximize/minimize buttons though.
So, as a workaround, the boilerplate is now setting the windows flag Qt.Tool, as I believe this a bit better than setting Qt.WindowStaysOnTopHint.
Unfortunately, there seems to be no way around this as for now.
The text was updated successfully, but these errors were encountered:
On Mac OS X, I was unable to get the floating window to always stay on top of Nuke. If you click in the main Nuke window, the floating window would disappear behind the main Nuke window.
I reached out to the Foundry:
This was the response from The Foundry:
So, as a workaround, the boilerplate is now setting the windows flag
Qt.Tool
, as I believe this a bit better than settingQt.WindowStaysOnTopHint
.Unfortunately, there seems to be no way around this as for now.
The text was updated successfully, but these errors were encountered: