Home >Web Front-end >JS Tutorial >ActiveQt interacts with js to realize graphic explanation

ActiveQt interacts with js to realize graphic explanation

小云云
小云云Original
2018-03-02 13:33:122942browse

This article mainly uses pictures and texts to share with you examples of interaction between ActiveQt and js. I hope it can help everyone.

1. Develop ActiveX creation project with vs2015+Qt 5.7

1.1. Select "Project" in "New"

1.2. Select Qt ActiveQt Server in Qt and fill in the project name, etc. The interface is as follows:

1.3. Then click Next until completion. The interface definition provided to the outside world is as shown below:

2 , vs2015 debugging ActiveX control environment configuration

2.1. Click the debug button drop-down and select "Attach process to"

2.2. Click the "Debug" button and select "Attach process to" from the drop-down menu to enter the following interface:

2.3. Find the iexplore.exe process , select the IE browser process with an empty "Title", click the "Attach" button, and you can debug at this time. The interface is as follows:

3. Interaction between ActiveQt and js callbacks

##3.1. Method 1: js directly rewrites Qt’s signal function

3.1.1. Qt Define signal method

voideventCallBack(intnType, QStringstrEventName);

##3.1.2, js rewrite method

First, define the OBJECT tag of the control and specify the id. Assuming that the id is ActiveQtServerCallBack, the js method is defined as follows:

functionActiveQtServerCallBack::eventCallBack(nType,strEventName)

{

                                                                        using using the logic code  

                               out out out out out out out way out’s ’     ’    ## Notes: (1) The names of each parameter must be consistent; (2) The function must be placed after the tag, otherwise an exception will occur and the callback cannot be made;

3.2. Method 2: js parameter callback

3.2.1. Qt defines parameters for external calls Interface

## 1) eventName[in]: This parameter can be selected by yourself, and is used here to display the callback content; Function address;

3.2.2. js definition callback method

function ActiveQtServerCallBackTrainsmitTest(x, y, z, strEvent)

# {

##// The logical code of implement           }

Notes: The x, y, z, strEvent parameters must be consistent with the parameter names defined in Qt, otherwise the callback cannot be made;

The above is the detailed content of ActiveQt interacts with js to realize graphic explanation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn