Home

QtControlHost Class Reference

A ControlHost is a widget that can host Microsoft.Net controls within a Qt application. More...

 #include <QtControlHost>

Inherits QWidget.

Properties

Public Functions

Static Public Members

Protected Functions

Additional Inherited Members


Detailed Description

A ControlHost is a widget that can host Microsoft.Net controls within a Qt application.

The hosted control can be associated with the ControlHost in several ways, one way is to allocate the control and then pass the reference to the constructor of the ControlHost:

 calendar = gcnew System::Windows::Forms::MonthCalendar();
 calendarHost = new QtControlHost(calendar, this);

Or one can change the control of the ControlHost by modifying the controlAssembly and controlType properties:

 calendarHost = new QtControlHost(this);
 calendarHost->setControlAssembly("system.windows.forms.dll");
 calendarHost->setControlType("System.Windows.Forms.MonthCalendar");

The last one allows dynamic creation of hosted controls without being dependent on a managed c++ extension.

Note that the ControlHost does not give an interface to modify the properties of the hosted control. If you need to call methods or modify some properties of the hosted control, you must operate directly on the hosted control. Use QtControlHost::control() to get a reference to the hosted control. If you rather want to embed a Qt widget within a .Net application you should use the WidgetHost.


Property Documentation

controlAssembly : QString

This property holds the assembly of the hosted control.

Access functions:

controlOwnership : QtWinFormsEnums::OwnershipType

This property holds the ownership of the Winforms control. If controlOwnership is External, an external object has the ownership of the control, and the ControlHost will not destroy the Control when ControlHost is destroyed or if the Control is changed with setControl().

Access functions:

controlType : QString

This property holds the type of the hosted control.

Access functions:


Member Function Documentation

QtControlHost::QtControlHost ( QWidget * parent = 0 )

Constructs a new ControlHost with the parent widget and no winforms control.

QtControlHost::QtControlHost ( System::Windows::Forms::Control ^ hostedControl, QWidget * parent = 0 )

Constructs a new ControlHost with the parent widget and the hosted control hostedControl

QtControlHost::~QtControlHost ()

Destructs the ControlHost. If the property controlOwnership is set to Host, the hosted control will be destroyed.

System::Windows::Forms::Control ^ QtControlHost::control () const   [virtual]

Returns the hosted control.

See also setControl().

System::Windows::Forms::Control ^ QtControlHost::createControl ( const QString & controlType, const QString & controlAssembly = QString() )   [static]

Creates a winforms control using the assembly controlAssembly and type controlType.

See also controlAssembly and controlType.

bool QtControlHost::event ( QEvent * e )   [virtual protected]

Reimplemented from QWidget::event(QEvent *e), and notifies the hosted control for some values of e that the hosted control is expected to react to. This function implements a method of QWidget that enables the hosted control to respond as expected when the event e occurs.

Reimplemented from QObject.

void QtControlHost::focusInEvent ( QFocusEvent * e )   [virtual protected]

This function implements a method of QWidget that enables the hosted control to respond as expected when the event e occurs.

Reimplemented from QWidget.

QSize QtControlHost::minimumSizeHint () const   [virtual]

Returns the minimum size of the hosted control.

Reimplemented from QWidget.

void QtControlHost::resizeEvent ( QResizeEvent * e )   [virtual protected]

This function implements a method of QWidget that enables the hosted control to respond as expected when the event e occurs.

Reimplemented from QWidget.

void QtControlHost::setControl ( System::Windows::Forms::Control ^ hostedControl )   [virtual]

Assigns the hosted control to hostedControl.

See also control().

void QtControlHost::showEvent ( QShowEvent * e )   [virtual protected]

Will show the hosted control. This function implements a method of QWidget that enables the hosted control to respond as expected when the event e occurs.

Reimplemented from QWidget.

QSize QtControlHost::sizeHint () const   [virtual]

Returns the preferred size of the hosted control.

Reimplemented from QWidget.


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