|  | 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.

- List of all members, including inherited members
- Obsolete members

## Public Functions

| QWinWidget ( HWND hParentWnd, QObject * parent = 0, Qt::WFlags f = 0 )
| ~QWinWidget ()
void | center ()
HWND | parentWindow () const
void | show ()

- 217 public functions inherited from QWidget
- 13 public functions inherited from QPaintDevice
- 29 public functions inherited from QObject

## Reimplemented Protected Functions

virtual void | childEvent ( QChildEvent * e )
virtual bool | eventFilter ( QObject * o, QEvent * e )
virtual void | focusInEvent ( QFocusEvent * e )
virtual bool | focusNextPrevChild ( bool next )
virtual bool | winEvent ( MSG * msg, long * result )

- 37 protected functions inherited from QWidget
- 1 protected function inherited from QPaintDevice
- 7 protected functions inherited from QObject

### Additional Inherited Members

- 58 properties inherited from QWidget
- 1 property inherited from QObject
- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 1 signal inherited from QWidget
- 1 signal inherited from QObject
- 1 public type inherited from QObject
- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject
- 37 protected functions inherited from QWidget
- 1 protected function inherited from QPaintDevice
- 7 protected functions inherited from QObject
- 1 protected slot inherited from QWidget
- 1 protected type inherited from QPaintDevice
- 2 protected variables inherited from QObject

## 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.

### void QWinWidget::childEvent ( QChildEvent * e ) `[virtual protected]`

Reimplemented from QObject::childEvent().

### bool QWinWidget::eventFilter ( QObject * o, QEvent * e ) `[virtual protected]`

Reimplemented from QObject::eventFilter().

### void QWinWidget::focusInEvent ( QFocusEvent * e ) `[virtual protected]`

Reimplemented from QWidget::focusInEvent().

### bool QWinWidget::focusNextPrevChild ( bool next ) `[virtual protected]`

Reimplemented from QWidget::focusNextPrevChild().

### 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().

### bool QWinWidget::winEvent ( MSG * msg, long * result ) `[virtual protected]`

Reimplemented from QWidget::winEvent().