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

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

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 )

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.

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


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