Home

QWinWidget Class Reference

The QWinWidget class is a Qt widget that can be child of a native Win32 widget. More...

 #include <QWinWidget>

Inherits QWidget.

Public Functions

Additional Inherited Members


Detailed Description

The QWinWidget class is a Qt widget that can be child of a native Win32 widget.

The QWinWidget class is the bridge between an existing application user interface developed using native Win32 APIs or toolkits like MFC, and Qt based GUI elements.

Using QWinWidget as the parent of QDialogs will ensure that modality, placement and stacking works properly throughout the entire application. If the child widget is a top level window that uses the WDestructiveClose flag, QWinWidget will destroy itself when the child window closes down.

Applications moving to Qt can use QWinWidget to add new functionality, and gradually replace the existing interface.


Member Function Documentation

QWinWidget::QWinWidget ( HWND hParentWnd, QObject * parent = 0, Qt::WFlags f = 0 )

Creates an instance of QWinWidget. hParentWnd is the handle to the native Win32 parent. If a parent is provided the object is owned by that QObject. f is passed on to the QWidget constructor.

QWinWidget::~QWinWidget ()

Destroys this object, freeing all allocated resources.

void QWinWidget::center ()

Centers this widget over the native parent window. Use this function to have Qt toplevel windows (i.e. dialogs) positioned correctly over their native parent windows.

 QWinWidget qwin(hParent);
 qwin.center();

 QMessageBox::information(&qwin, "Caption", "Information Text");

This will center the message box over the client area of hParent.

HWND QWinWidget::parentWindow () const

Returns the handle of the native Win32 parent window.

void QWinWidget::show ()

Shows this widget. Overrides QWidget::show().

See also showCentered().


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions