Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
QWinWidget Class Reference

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

#include <qwinwidget.h>

Inheritance diagram for QWinWidget:
[legend]
Collaboration diagram for QWinWidget:
[legend]

Public Member Functions

void center ()
 
HWND parentWindow () const
 
 QWinWidget (CWnd *parnetWnd, QObject *parent=0, Qt::WindowFlags f={})
 
 QWinWidget (HWND hParentWnd, QObject *parent=0, Qt::WindowFlags f={})
 
void show ()
 
void showCentered ()
 
 ~QWinWidget ()
 

Protected Member Functions

void childEvent (QChildEvent *e)
 
bool eventFilter (QObject *o, QEvent *e)
 
void focusInEvent (QFocusEvent *e)
 
bool focusNextPrevChild (bool next)
 
bool nativeEvent (const QByteArray &eventType, void *message, qintptr *result)
 

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.

Constructor & Destructor Documentation

◆ QWinWidget() [1/2]

QWinWidget::QWinWidget ( HWND hParentWnd,
QObject * parent = 0,
Qt::WindowFlags f = {} )

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() [2/2]

QWinWidget::QWinWidget ( CWnd * parentWnd,
QObject * parent = 0,
Qt::WindowFlags f = {} )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Creates an instance of QWinWidget. parentWnd is a pointer to an MFC window object. If a parent is provided the object is owned by that QObject. f is passed on to the QWidget constructor.

◆ ~QWinWidget()

QWinWidget::~QWinWidget ( )

Destroys this object, freeing all allocated resources.

Member Function Documentation

◆ center()

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");
The QWinWidget class is a Qt widget that can be child of a native Win32 widget.
Definition qwinwidget.h:15

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

◆ childEvent()

void QWinWidget::childEvent ( QChildEvent * e)
protected

\reimp

◆ eventFilter()

bool QWinWidget::eventFilter ( QObject * o,
QEvent * e )
protected

\reimp

◆ focusInEvent()

void QWinWidget::focusInEvent ( QFocusEvent * e)
protected

\reimp

◆ focusNextPrevChild()

bool QWinWidget::focusNextPrevChild ( bool next)
protected

\reimp

◆ nativeEvent()

bool QWinWidget::nativeEvent ( const QByteArray & eventType,
void * message,
qintptr * result )
protected

\reimp

◆ parentWindow()

HWND QWinWidget::parentWindow ( ) const

Returns the handle of the native Win32 parent window.

◆ show()

void QWinWidget::show ( )

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

See also
showCentered()

◆ showCentered()

void QWinWidget::showCentered ( )

\obsolete

Call center() instead.


The documentation for this class was generated from the following files: