Giter Site home page Giter Site logo

Comments (12)

rdeioris avatar rdeioris commented on June 24, 2024 2

@Papoun reopening the issue, as it looks like a new revamp of QT for python is coming and i would like to support it in the best possible way

from unrealenginepython.

rdeioris avatar rdeioris commented on June 24, 2024 1

sorry, fixed

from unrealenginepython.

sinokgr avatar sinokgr commented on June 24, 2024

Any news on this one? 🤔

from unrealenginepython.

rdeioris avatar rdeioris commented on June 24, 2024

What kind of argument type Qt expects for the window handle ?

from unrealenginepython.

osstony avatar osstony commented on June 24, 2024

We will want the integer for the Unreal HWND.

After that, in python, we will need to create an invisible Qt proxy parent widget which is parented to the Unreal window using win32gui methods. The invisible Qt proxy parent widget will then act as the main window parent for future widgets.

from unrealenginepython.

sinokgr avatar sinokgr commented on June 24, 2024

@rdeioris have a look at this example, it might be helpful
https://github.com/alfalfasprossen/qtinwin/blob/master/maxparenting.py

from unrealenginepython.

rdeioris avatar rdeioris commented on June 24, 2024

@sinokgr i have added this:

import unreal_engine as ue

root_window = ue.get_editor_window()
ue.log(root_window.get_window_handle())

i think it should be enough for you

from unrealenginepython.

sinokgr avatar sinokgr commented on June 24, 2024

worked fine! Thanks! 😀

from unrealenginepython.

sinokgr avatar sinokgr commented on June 24, 2024

Hi @rdeioris, I just downloaded and re-compiled the latest version with levels support and it looks like this stopped working. Have you accidentally deleted this line of code or is intentional?

from unrealenginepython.

Papoun avatar Papoun commented on June 24, 2024

Bumping this one ^^' Not sure if i need to create a new thead ? sorry if that's the case !
How are you setting the UE window as a parent of a QtWidget, @sinokgr ?

I haven't been able to get the unreal window from it's hwnd (using ue.get_editor_window().get_handle() for the hwnd) with Ctypes (PyCObject_AsVoidPtr is deprecated in 3.6 when trying a similar approach to the 3DS Max parenting one) or the win32gui one.

Thanks !

from unrealenginepython.

Papoun avatar Papoun commented on June 24, 2024

An update on this. You can get the handle of the ue4 editor window with ctypes like so :
handle = ctypes.windll.user32.GetForegroundWindow()

And use the windll's SetParent to set the Qt widget (self) as a child of the unreal editor window :
ctypes.windll.user32.SetParent(self.winId(), handle)

A few issues arise from this though. You cant for instance move the Qt widget outside of ue4 like a regular unreal window/tab. This can be pretty annoying if the user tries to move the Qt window on another screen or outside of the unreal window geometry.

I ended up resorting to a simpler method where im using a thread to monitor the current foreground application, but would really like to see if the problems above still persist with different methods !

from unrealenginepython.

rdeioris avatar rdeioris commented on June 24, 2024

Closing it as now we have the set_as_owner() api function:

https://github.com/20tab/UnrealEnginePython/blob/master/README.md#integration-with-qt4qt5pyside2

from unrealenginepython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.