Development of QT + ArcGIS Engine 10.1 (2)

Source: Internet
Author: User
Tags qt designer
    • General Process
    • Use QT designer
    1. ArcGIS Engine + QT (GUI development, using the methods provided by QT)

The above method is not suitable for debugging, so I believe you will not like it. In fact, I do not like it either. We will use this method. This method does not need the DLL mentioned above, therefore, no additional configuration is required. Qt providesQaxwidgetThis class is used as the container of our axtivex control. For more information, see help, for example:


    1. General Process
      1. Statement

Declare a qaxwidget type variable, such as qaxwidget * m_paxmapwidget;

    1. Instantiation

M_paxmapwidget = new qaxwidget (this );

    1. Associate ActiveX Components

M_paxmapwidget-> setcontrol ("{C552EA94-6FBB-11d5-A9C1-00104BB6FC1C }");// Guid

    1. Display

We can use the addwidget () method to display our ActiveX components, for example:

Pv =NewQvboxlayout;

PV-> addlayout (ph );

PV-> addwidget (m_paxmapwidget );

    1. Use QT designer

I am a lazy person, especially when I am working on the interface, and there is no art cell. I remember that in MFC, I also said this because I am a person greatly influenced by net, I always like to drag controls to the interface. We can also do this with QT designers in QT.

    1. Interface Layout

Open the QT designer, place several layout controls, and find

Qaxwidget and drag it to the interface, such:


The drag-and-drop interface is as follows:


Right-click the drag-and-drop control and select the control. The following selection box is displayed (the operation is the same as that in MFC)

Because this method uses qaxwdiget, you need to add qaxcontainerd. lib to the dependency item as soon as possible, such:

    1. AddCode

Before adding code, let's use the following figure to see how the interface in QT isProgramHook up (if you cannot understand it, use vs to trace it, and use a program to trace it. Understanding this process will be helpful for our future study. If you don't want to use it, you can write it yourself, i'm not talking about it, I'm a lazy person). Once we know this process, we know how to add code.

Figure from:


I don't know why the guid of axtivex IN THE automatically generated code is not associated. We just need to add the code in the red box below in the setupui function:


In the header file of the ui_qtmapaxtiv (ui_mainwindow) header file, add the pointer variables of the three controls, for example:

In the qtmapaxtive (corresponding mainwindow) class, add three pointer variables and a function that adds buttons and commands to the toolbar, for example:


Get the pointer variable of the control in the constructor, for example:

The code for adding a toolbar command to a function is as follows:

Running effect:

conclusion: Through this example, we know how to use QT to load ActiveX controls, including the ones provided by ESRI, and compare this method with the above method, find the method that suits you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.