[Qt-interest] When does QWidget have HWND?
Girish Ramakrishnan
girish at forwardbias.in
Fri Feb 18 12:20:31 CET 2011
Hi William,
Which Windows version are you using? Windows 7? Are you aware of
http://bugreports.qt.nokia.com/browse/QTBUG-14297?
Girish
On Fri, Feb 18, 2011 at 2:03 PM, william lee <welemon at gmail.com> wrote:
> Hi,
>
> I was using spy++ to check Qt application window, sometime I get the HWND
> for each widget, like button, edit, combo etc. Sometime there isn’t HWND for
> child widget at all.There is only a whole window HWND.
>
>
>
> For example, Qt 4.6.1.
>
> 1. When you launch qtdemo’s browser project(QtWebKit demo browser),
> you can use spy++ to check on it, there is only one parent window HWND. No
> child window HWND, like menu bar, toolbar etc.
>
> 2. When you launch qtdemo’s Text Edit project, you can use spy++ to
> check again, this time you will see every child window has HWND, including
> menu bar, toolbar etc.
>
> 3. Another weird example is qtdemo’s SQL Browser project, when you
> launch this application, it will pop up a dialog, “Connect…”. This Dialog is
> for adding connections.
>
> The first time launch this dialog(when app start, it will auto popup), you
> use spy++ to check on it, there is only one HWND for whole dialog, no child
> HWND.
>
> But when you close it, and launch again from File->Add connection…, you can
> use spy++ to check again, now it will have all child widget with HWND…
>
>
>
> I googled, and find something about alien widget, I read this before. The
> comments are like:
>
> Native Widgets vs Alien Widgets
>
> Introduced in Qt 4.4, alien widgets are widgets unknown to the windowing
> system. They do not have a native window handle associated with them. This
> feature significantly speeds up widget painting, resizing, and removes
> flicker.
>
> Should you require the old behavior with native windows, you can choose one
> of the following options:
>
> Use the QT_USE_NATIVE_WINDOWS=1 in your environment.
> Set the Qt::AA_NativeWindows attribute on your application. All widgets will
> be native widgets.
> Set the Qt::WA_NativeWindow attribute on widgets: The widget itself and all
> of its ancestors will become native (unless Qt::WA_DontCreateNativeAncestors
> is set).
> Call QWidget::winId to enforce a native window (this implies 3).
> Set the Qt::WA_PaintOnScreen attribute to enforce a native window (this
> implies 3).
>
>
>
> http://doc.qt.nokia.com/latest/qwidget.html
>
>
>
> But I didn’t see any relative code in above three projects. Don’t know why
> there is difference, especially for example 3, the same dialog can have
> different behavior.
>
>
>
> Can someone help me to explain it?
>
>
>
> Thanks!
>
>
>
> William L.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
More information about the Qt-interest-old
mailing list