Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QAxWidget Class

TheQAxWidget class is aQWidget that wraps an ActiveX control.More...

Header:#include <QAxWidget>
Inherits:QWidget andQAxBase

Public Functions

QAxWidget(QWidget * parent = 0, Qt::WindowFlags f = 0)
QAxWidget(const QString & c, QWidget * parent = 0, Qt::WindowFlags f = 0)
QAxWidget(IUnknown * iface, QWidget * parent = 0, Qt::WindowFlags f = 0)
~QAxWidget()
virtual QAxAggregated *createAggregate()
booldoVerb(const QString & verb)

Reimplemented Public Functions

virtual voidclear()
virtual QSizeminimumSizeHint() const
virtual QSizesizeHint() const
  • 220 public functions inherited fromQWidget
  • 19 public functions inherited fromQAxBase
  • 29 public functions inherited fromQObject
  • 12 public functions inherited fromQPaintDevice

Protected Functions

virtual boolcreateHostWindow(bool initialized)
boolcreateHostWindow(bool initialized, const QByteArray & data)
virtual booltranslateKeyEvent(int message, int keycode) const

Reimplemented Protected Functions

virtual voidchangeEvent(QEvent * e)
virtual voidconnectNotify(const char * signal)
virtual boolinitialize(IUnknown ** ptr)
virtual voidresizeEvent(QResizeEvent *)
  • 37 protected functions inherited fromQWidget
  • 5 protected functions inherited fromQAxBase
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice

Additional Inherited Members

  • 58 properties inherited fromQWidget
  • 1 property inherited fromQAxBase
  • 1 property inherited fromQObject
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject
  • 1 signal inherited fromQWidget
  • 3 signals inherited fromQAxBase
  • 1 signal inherited fromQObject
  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQAxWidget class is aQWidget that wraps an ActiveX control.

AQAxWidget can be instantiated as an empty object, with the name of the ActiveX control it should wrap, or with an existing interface pointer to the ActiveX control. The ActiveX control's properties, methods and events which only useQAxBase supported data types, become available as Qt properties, slots and signals. The base classQAxBase provides an API to access the ActiveX directly through theIUnknown pointer.

QAxWidget is aQWidget and can mostly be used as such, e.g. it can be organized in a widget hierarchy and layouts or act as an event filter. Standard widget properties, e.g.enabled are supported, but it depends on the ActiveX control to implement support for ambient properties like e.g. palette or font.QAxWidget tries to provide the necessary hints.

However, you cannot reimplement Qt-specific event handlers likemousePressEvent orkeyPressEvent and expect them to be called reliably. The embedded control covers theQAxWidget completely, and usually handles the user interface itself. Use control-specific APIs (i.e. listen to the signals of the control), or use standard COM techniques like window procedure subclassing.

QAxWidget also inherits most of its ActiveX-related functionality fromQAxBase, notablydynamicCall() andquerySubObject().

Warning: You can subclassQAxWidget, but you cannot use theQ_OBJECT macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate theQAxWidget as a member of theQObject subclass.

See alsoQAxBase,QAxObject,QAxScript, andActiveQt Framework.

Member Function Documentation

QAxWidget::QAxWidget(QWidget * parent = 0,Qt::WindowFlags f = 0)

Creates an emptyQAxWidget widget and propagatesparent andf to theQWidget constructor. To initialize a control, callsetControl().

QAxWidget::QAxWidget(constQString & c,QWidget * parent = 0,Qt::WindowFlags f = 0)

Creates anQAxWidget widget and initializes the ActiveX controlc.parent andf are propagated to theQWidget contructor.

See alsosetControl().

QAxWidget::QAxWidget(IUnknown * iface,QWidget * parent = 0,Qt::WindowFlags f = 0)

Creates aQAxWidget that wraps the COM object referenced byiface.parent andf are propagated to theQWidget contructor.

QAxWidget::~QAxWidget()

Shuts down the ActiveX control and destroys theQAxWidget widget, cleaning up all allocated resources.

See alsoclear().

[virtual protected]void QAxWidget::changeEvent(QEvent * e)

Reimplemented fromQWidget::changeEvent().

[virtual]void QAxWidget::clear()

Reimplemented fromQAxBase::clear().

Shuts down the ActiveX control.

[virtual protected]void QAxWidget::connectNotify(constchar * signal)

Reimplemented fromQObject::connectNotify().

[virtual]QAxAggregated * QAxWidget::createAggregate()

Reimplement this function when you want to implement additional COM interfaces for the client site of the ActiveX control, or when you want to provide alternative implementations of COM interfaces. Return a new object of aQAxAggregated subclass.

The default implementation returns the null pointer.

[virtual protected]bool QAxWidget::createHostWindow(bool initialized)

Creates the client site for the ActiveX control, and returns true if the control could be embedded successfully, otherwise returns false. Ifinitialized is true the control has already been initialized.

This function is called byinitialize(). If you reimplement initialize to customize the actual control instantiation, call this function in your reimplementation to have the control embedded by the default client side. Creates the client site for the ActiveX control, and returns true if the control could be embedded successfully, otherwise returns false.

[protected]bool QAxWidget::createHostWindow(bool initialized, constQByteArray & data)

Creates the client site for the ActiveX control, and returns true if the control could be embedded successfully, otherwise returns false. Ifinitialized is false the control will be initialized using thedata. The control will be initialized through either IPersistStreamInit or IPersistStorage interface.

If the control needs to be initialized using custom data, call this function in your reimplementation ofinitialize(). This function is not called by the default implementation ofinitialize().

This function was introduced in Qt 4.4.

bool QAxWidget::doVerb(constQString & verb)

Requests the ActiveX control to perform the actionverb. The possible verbs are returned byverbs().

The function returns true if the object could perform the action, otherwise returns false.

This function was introduced in Qt 4.1.

[virtual protected]bool QAxWidget::initialize(IUnknown ** ptr)

Reimplemented fromQAxBase::initialize().

CallsQAxBase::initialize(ptr), and embeds the control in this widget by callingcreateHostWindow(false) if successful.

To initialize the control before it is activated, reimplement this function and add your initialization code before you callcreateHostWindow(true).

This function was introduced in Qt 4.2.

[virtual]QSize QAxWidget::minimumSizeHint() const

Reimplemented fromQWidget::minimumSizeHint().

[virtual protected]void QAxWidget::resizeEvent(QResizeEvent *)

Reimplemented fromQWidget::resizeEvent().

[virtual]QSize QAxWidget::sizeHint() const

Reimplemented fromQWidget::sizeHint().

[virtual protected]bool QAxWidget::translateKeyEvent(int message,int keycode) const

Reimplement this function to pass certain key events to the ActiveX control.message is the Window message identifier specifying the message type (ie. WM_KEYDOWN), andkeycode is the virtual keycode (ie. VK_TAB).

If the function returns true the key event is passed on to the ActiveX control, which then either processes the event or passes the event on to Qt.

If the function returns false the processing of the key event is ignored byActiveQt, ie. the ActiveX control might handle it or not.

The default implementation returns true for the following cases:

WM_SYSKEYDOWNWM_SYSKEYUPWM_KEYDOWN
All keycodesVK_MENUVK_TAB, VK_DELETE and all non-arrow-keys in combination with VK_SHIFT, VK_CONTROL or VK_MENU

This table is the result of experimenting with popular ActiveX controls, ie. Internet Explorer and Microsoft Office applications, but for some controls it might require modification.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp