Unsolved Create my widget from HWND?
-
I created a widget (MyWidget) window in QT Designer w/classes, it will show as an independent window on desktop without any parent, but I have to use an existing HWND to create the instance of MyWidget. Is it possible?
-
@Taytoo said in Create my widget from HWND?:
but I have to use an existing HWND to create the instance of MyWidget
Sorry, but that doesn't make sense. You don't create widgets or windows using a HWND. HWND is a handle that you can get from an existing window. It's like a pointer in C++. You don't use pointers to create instances of classes. You can get a pointer to an existing instance.
So if you have an existing HWND that means you have a native window. You can embed a widget inside that native window if you want. You would do that by getting the widget's HWND (using winId()) and then use native SetParent() to make the widget child of that existing window.
-
@Taytoo said in Create my widget from HWND?:
Is it possible?
Not easily and involves some really nasty tricks. My advice: don't! See what @Chris-Kawa wrote, try to work around the issue. Why do you require this anyway?