Download

Dock QtWidget to Unreal

Is there a way to dock a Qt Widget to an Editor UI?

I don’t think you can use Qt framework inside Unreal Engine 4 editor without heavily modifying the engine, and honestly I don’t know why you want to do that. Slate is a really powerful UI framework and also there is now the possibility to create UMG Editor Widget.

We use PySide in Unreal so basically Qt. Can’t answer regarding to docking the widgets so would be interesting if someone have experience doing this.


window = None # Required to be a global variable due to Unreals garbage collector
def main():
    app = None
    if not QApplication.instance():
        app = QApplication(sys.argv)

    global window
    window = MyWidget()

    unreal.parent_external_window_to_slate(window.winId())
    window.show()

if __name__ == "__main__":
    main()

@andreas.ranman

Yeah, we are using it in a similar fashion, but without setting the winId

However, didn’t find a good way of docking.

@andrea.b
There are many reasons why you would wan’t to use pyqt in unreal. For instance, if you already have a tool that is written in pyqt and wan’t to integrate it into unreal. Furthermore, there is not a lot of information about custom UI’s about Unreal, I wouldn’t know how to replicate a full-blown pyqt interface like treeviews/tabs/modifiers.

The Slate UI framework (which is the same framework that powers UE4 Editor) is pretty solid in terms of widgets and features, however is not well documented. I usually dig into the UE4 Editor code to understand how to use its API.

I can tell you that you can dock any kind of custom widget (SCoumpondWidget) using the FGlobalTabmanager singleton instance, create a SDockTab widget and set your custom widget as its content. I don’t know if you can somehow bridge a PyQt widget as content for a SDockTab.
As for TreeViews there is a widget called STreeView that is used widely in the Editor, the ContentBrowser and WorldOutliner use that.