搭建好qt项目后
在main.cpp中写入如下代码
#include "test.h" #include <QtWidgets/QApplication> #include <QAxWidget> #include <QString> int main(int argc, char *argv[]) { QApplication a(argc, argv); QAxWidget *map=new QAxWidget(0,0); map->resize(1000,800); map->setControl(QString::fromUtf8("{C54A9308-CECF-42F4-85DD-96F8AD9A67C6}")); map->dynamicCall("openTerrain(string,string,string,string)","http://www.drawsee.com/service20/TerrainService/TerrainService.asmx/","China","http://www.drawsee.com/service20/TerrainImageService/TerrainImageService.asmx/","earthnew"); map->show(); //test w; //w.show(); return a.exec(); }
C54A9308-CECF-42F4-85DD-96F8AD9A67C6是地图插件的id这个是个标识。
其中openTerrain是打开地图的方法。