Home

QWinWidget Class Reference

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

#include <qwinwidget.h>

List of all member functions.

Public 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, const char * name = 0, 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. name and f are passed on to the QWidget constructor.

The object has a default background mode of NoBackground.

QWinWidget::~QWinWidget ()

Destroys this object, freeing all allocated resources.

QMenuData * QWinWidget::menuBar () const

Returns a QMenuData object that wraps the native parent window's menu bar, and creates a menu bar if it doesn't exist yet.

If no parent window has been set yet, or if that window cannot have a menu bar this function returns 0.

Example: win32/main.cpp.

HWND QWinWidget::parentWindow () const

Returns the handle of the native Win32 parent window.

void QWinWidget::showCentered ()

Shows this widget centered over the native parent window. Use this function to have Qt toplevel widgets positioned correctly over their native parent windows.

    QWinWidget qwin( hParent );
    qwin.showCentered();

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

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

Examples: qtdll/main.cpp, step3/qtmfc.cpp, and win32/main.cpp.


This file is part of the Qt Solutions. Copyright © 2003-2004 Trolltech. All Rights Reserved.

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions