I am trying to parent a QMainWindow to a non-qt application (the application may change). Any ideas on how to do this?
The qt window opens fine and i can interact with the python API in the applications however the qt window goes behind the application window if i click on the application. I could use Qt.WindowStaysOnTopHint flag but then it's on top of everything which isn't ideal.
Psuedo Example: If you were using an application (example Nuke) where the main application is also qt based you would use something like:
def _nuke_main_window():
"""Returns Nuke's main window"""
for obj in QtWidgets.qApp.topLevelWidgets():
if (obj.inherits('QMainWindow') and
obj.metaObject().className() == 'Foundry::UI::DockMainWindow'):
return obj
else:
raise RuntimeError('Could not find DockMainWindow instance')
wdg = myWidget(parent=_nuke_main_window())
wdg.show()
Maya and any other pyqt based window also would work similarly.
However if the application isnt qt based:
wdg = myWidget(parent=nonQtWindowQt_ised)
wdg.show()
where:
def nonQtWindowQt_ised():
#return the application main window somehow maybe through python bindings like SIP?
Any examples (ideally) or useful direction would be much appreciated.
Using PyQt5, Python 3.5 and Linux.