[Qt-interest] is it possible to get a non-changing winId?
Ross Bencina
rossb-lists at audiomulch.com
Wed Jun 3 08:05:15 CEST 2009
Hi Karol
Karol Krizka wrote:
>> My question is: is there any way to stop Qt reallocating the HWND and get
>> it
>> to keep the same HWND for the entire life of the QWidget? Is there any
>> other
>> way I can integrate a standard windows handle into Qt? Would
>> WA_NativeWindow
>> help?
>>
>I'm doing something similar (using Irrlicht to render 3D stuff into a
>QWidget), and I never had the winId change on me. However, I make sure
>that I take the winId AFTER the widget has been show and the first
>paintEvent has been sent. A year or two ago, I dug through the Qt code
>and I think that I've found that the winId becomes stable after the
>widget is shown. Are you by any chance grabbing the winId in a
>constructor?
Yes I am grabbing it before the parent gets shown. The final runtime widget
tree is something like this:
ScrollArea (QWidget subclass)
FrameWidgetForPluginX (QWidget subclass)
ParentWidgetForPluginX (QWidget subclass)
PluginHWND (native Win32 window, has
ParentWidgetForPluginX::winId as parent)
In the constructor for FrameWidgetForPluginX, I also construct
ParentWidgetForPluginX and pass its HWND to the plugin.
At the time FrameWidgetForPluginX is constructed it has not been shown, and
it has not had its parent set to ScrollArea->viewport() yet.
>From what you say I might need to rearrange for the construction of
ParentWidgetForPluginX to happen later.. but of course this will create all
kinds of layout/sizing pain since I won't be able to ask PluginHWND for its
dimensions.
Thoughts?
Thanks
Ross.
More information about the Qt-interest-old
mailing list