QAxBaseWidget 類

QAxBaseWidget 提供靜態特性和信號為 QAxWidget . 更多...

頭: #include <QAxBaseWidget>
CMake: find_package(Qt6 REQUIRED COMPONENTS AxContainer)
target_link_libraries(mytarget PRIVATE Qt6::AxContainer)
qmake: QT += axcontainer
Since: Qt 6.0
繼承: QWidget and QAxObjectInterface
繼承者:

QAxWidget

特性

信號

void exception (int code , const QString & source , const QString & desc , const QString & help )
void propertyChanged (const QString & name )
void signal (const QString & name , int argc , void * argv )

詳細描述

特性文檔編製

classContext : const ulong

This property holds the context the ActiveX control will run in (default CLSCTX_SERVER).

The property affects the "dwClsContext" argument when calling CoCreateInstance. This can be used to control in-proc vs. out-of-proc startup for controls supporting both alternatives. Also, it can be used to modify/reduce control permissions when used with CLSCTX_ENABLE_CLOAKING and an impersonation token.

Note that it must be set before setControl () to have any effect.

另請參閱 control .

control : const QString

此特性保持包裹的 COM 對象名稱通過此 QAxBaseWidget 對象。

設置此特性將初始化 COM (組件對象模型) 對象。關閉先前設置的任何 COM 對象。

設置此特性的最有效方式是使用注冊組件 UUID,如

ctrl->setControl("{8E27C92B-1264-101C-8A2F-040224009C02}");
					

第 2 種最快方式是使用已注冊控件類名 (帶或不帶版本號),如

ctrl->setControl("MSCal.Calendar");
					

最慢但最輕鬆的方式是使用控件的完整名稱,如

ctrl->setControl("Calendar Control 9.0");
					

從文件初始化對象也是可能的,如

ctrl->setControl("c:/files/file.doc");
					

若使用組件 UUID 則可以使用下列模式初始化遠程機器控件,以初始化許可控件或連接到正運行對象:

  • 要初始化不同機器中的控件,使用以下模式:
    <domain/username>:<password>@server/{8E27C92B-1264-101C-8A2F-040224009C02}
    							
  • 要初始化許可控件,使用以下模式:
    {8E27C92B-1264-101C-8A2F-040224009C02}:<LicenseKey>
    							
  • 要連接到已運行對象,使用以下模式:
    {8E27C92B-1264-101C-8A2F-040224009C02}&
    							

前 2 種模式可以組閤,如初始化遠程機器中的許可控件:

ctrl->setControl("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey");
					

控件的讀取函數始終返迴控件的 UUID,若提供包括許可密鑰和服務器名稱,但不包括用戶名、域或口令。

另請參閱 classContext .

成員函數文檔編製

[signal] void QAxBaseWidget:: exception ( int code , const QString & source , const QString & desc , const QString & help )

This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. code , source , desc and help provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. help includes the help file, and the help context ID in brackets, e.g. "filename [id]".

另請參閱 QAxBaseObject::exception ().

[signal] void QAxBaseWidget:: propertyChanged (const QString & name )

若 COM (組件對象模型) 對象支持特性通知,此信號獲得發射當特性稱為 name 改變。

另請參閱 QAxBaseObject::propertyChanged ().

[signal] void QAxBaseWidget:: signal (const QString & name , int argc , void * argv )

This generic signal gets emitted when the COM object issues the event name . argc is the number of parameters provided by the event (DISPPARAMS.cArgs), and argv is the pointer to the parameter values (DISPPARAMS.rgvarg). Note that the order of parameter values is turned around, ie. the last element of the array is the first parameter in the function.

void Receiver::slot(const QString &name, int argc, void *argv)
{
    VARIANTARG *params = (VARIANTARG*)argv;
    if (name.startsWith("BeforeNavigate2(")) {
        IDispatch *pDisp = params[argc-1].pdispVal;
        VARIANTARG URL = *params[argc-2].pvarVal;
        VARIANTARG Flags = *params[argc-3].pvarVal;
        VARIANTARG TargetFrameName = *params[argc-4].pvarVal;
        VARIANTARG PostData = *params[argc-5].pvarVal;
        VARIANTARG Headers = *params[argc-6].pvarVal;
        bool *Cancel = params[argc-7].pboolVal;
    }
}
					

Use this signal if the event has parameters of unsupported data types. Otherwise, connect directly to the signal name .

另請參閱 QAxBaseObject::signal ().