├── mymap.qrc
├── notice.txt
├── MapFile
├── test.html
└── BaiduMap.html
├── mainwindow.h
├── main.cpp
├── MyMap.pro
├── mainwindow.cpp
├── webaxwidget.h
├── mainwindow.ui
└── MyMap.pro.user
/mymap.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/notice.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qiuzhiqian/QT_MyMap/HEAD/notice.txt
--------------------------------------------------------------------------------
/MapFile/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HHHHHH
6 | LLLLLLLLLLLLLLLLLL
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class MainWindow;
8 | }
9 |
10 | class MainWindow : public QMainWindow
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit MainWindow(QWidget *parent = 0);
16 | ~MainWindow();
17 |
18 | void webShow(const QString &url);
19 |
20 | private slots:
21 | void showAddrWeb();
22 | void showBaiduMap();
23 |
24 | private:
25 | Ui::MainWindow *ui;
26 |
27 |
28 | };
29 |
30 | #endif // MAINWINDOW_H
31 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "webaxwidget.h"
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 |
9 | QCoreApplication::setApplicationVersion(QT_VERSION_STR);
10 | QCoreApplication::setApplicationName("Active Qt Web Browser");
11 | QCoreApplication::setOrganizationName("QtProject");
12 |
13 | MainWindow w;
14 |
15 | //const QString url="https://www.baidu.com/";
16 | //w.webShow(url);
17 | w.show();
18 |
19 | return a.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MyMap.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2016-05-19T21:34:35
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 | QT += widgets axcontainer
9 |
10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
11 |
12 | TARGET = MyMap
13 | TEMPLATE = app
14 |
15 |
16 | SOURCES += main.cpp\
17 | mainwindow.cpp
18 |
19 | HEADERS += mainwindow.h \
20 | webaxwidget.h
21 |
22 | FORMS += mainwindow.ui
23 |
24 | DISTFILES +=
25 |
26 | RESOURCES += \
27 | mymap.qrc
28 |
--------------------------------------------------------------------------------
/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "ui_mainwindow.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | MainWindow::MainWindow(QWidget *parent) :
10 | QMainWindow(parent),
11 | ui(new Ui::MainWindow)
12 | {
13 | ui->setupUi(this);
14 |
15 | ui->addrLineEdit->setText("https://www.baidu.com/");
16 | this->showAddrWeb();
17 |
18 | connect(ui->goPushButton,SIGNAL(clicked(bool)),this,SLOT(showAddrWeb()));
19 | connect(ui->mapBtn,SIGNAL(clicked(bool)),this,SLOT(showBaiduMap()));
20 | }
21 |
22 | MainWindow::~MainWindow()
23 | {
24 | delete ui;
25 | }
26 |
27 | void MainWindow::webShow(const QString &url)
28 | {
29 | ui->webBrowser->dynamicCall("Navigate(const QString&)", url);
30 | }
31 |
32 | void MainWindow::showAddrWeb()
33 | {
34 | QString addr=ui->addrLineEdit->text();
35 | //if((addr.indexOf("www")!=0)&&(addr.indexOf("http")!=0)) return;
36 | webShow(addr);
37 | }
38 |
39 | void MainWindow::showBaiduMap()
40 | {
41 | QString mapHtml=QDir::currentPath()+"/MapFile/BaiduMap.html";
42 | qDebug()<addrLineEdit->setText("地图");
45 | webShow(mapHtml);
46 | }
47 |
--------------------------------------------------------------------------------
/MapFile/BaiduMap.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 百度地图API自定义地图
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
55 |
--------------------------------------------------------------------------------
/webaxwidget.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2015 The Qt Company Ltd.
4 | ** Contact: http://www.qt.io/licensing/
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of The Qt Company Ltd nor the names of its
21 | ** contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | #ifndef WEBAXWIDGET_H
42 | #define WEBAXWIDGET_H
43 |
44 | #include
45 | #include "windows.h"
46 |
47 | class WebAxWidget : public QAxWidget
48 | {
49 | public:
50 |
51 | WebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0)
52 | : QAxWidget(parent, f)
53 | {
54 | }
55 | protected:
56 | bool translateKeyEvent(int message, int keycode) const Q_DECL_OVERRIDE
57 | {
58 | if (message >= WM_KEYFIRST && message <= WM_KEYLAST)
59 | return true;
60 | else
61 | return QAxWidget::translateKeyEvent(message, keycode);
62 | }
63 |
64 | };
65 |
66 | #endif // WEBAXWIDGET_H
67 |
--------------------------------------------------------------------------------
/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 774
10 | 473
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 | 9
20 |
21 |
22 | 4
23 |
24 | -
25 |
26 |
27 | QFrame::StyledPanel
28 |
29 |
30 | QFrame::Raised
31 |
32 |
33 |
34 | 5
35 |
36 |
37 | 0
38 |
39 |
40 | 5
41 |
42 |
43 | 5
44 |
45 |
-
46 |
47 |
-
48 |
49 |
50 | -
51 |
52 |
53 | Go
54 |
55 |
56 |
57 | -
58 |
59 |
60 | Map
61 |
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 | {8856f961-340a-11d0-a96b-00c04fd705a2}
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | QAxWidget
84 | QWidget
85 |
86 |
87 |
88 | WebAxWidget
89 | QAxWidget
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/MyMap.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {b96c068e-39ea-474a-8567-a32ce66c9500}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | 0
45 | 8
46 | true
47 | 1
48 | true
49 | true
50 | true
51 | false
52 |
53 |
54 |
55 | ProjectExplorer.Project.PluginSettings
56 |
57 |
58 |
59 | ProjectExplorer.Project.Target.0
60 |
61 | Desktop Qt 5.6.0 MinGW 32bit
62 | Desktop Qt 5.6.0 MinGW 32bit
63 | qt.56.win32_mingw49_kit
64 | 0
65 | 0
66 | 0
67 |
68 | G:/QT_source/build-MyMap-Desktop_Qt_5_6_0_MinGW_32bit-Debug
69 |
70 |
71 | true
72 | qmake
73 |
74 | QtProjectManager.QMakeBuildStep
75 | true
76 |
77 | false
78 | false
79 | false
80 |
81 |
82 | true
83 | Make
84 |
85 | Qt4ProjectManager.MakeStep
86 |
87 | false
88 |
89 |
90 |
91 | 2
92 | 构建
93 |
94 | ProjectExplorer.BuildSteps.Build
95 |
96 |
97 |
98 | true
99 | Make
100 |
101 | Qt4ProjectManager.MakeStep
102 |
103 | true
104 | clean
105 |
106 |
107 | 1
108 | 清理
109 |
110 | ProjectExplorer.BuildSteps.Clean
111 |
112 | 2
113 | false
114 |
115 | Debug
116 |
117 | Qt4ProjectManager.Qt4BuildConfiguration
118 | 2
119 | true
120 |
121 |
122 | G:/QT_source/build-MyMap-Desktop_Qt_5_6_0_MinGW_32bit-Release
123 |
124 |
125 | true
126 | qmake
127 |
128 | QtProjectManager.QMakeBuildStep
129 | false
130 |
131 | false
132 | false
133 | false
134 |
135 |
136 | true
137 | Make
138 |
139 | Qt4ProjectManager.MakeStep
140 |
141 | false
142 |
143 |
144 |
145 | 2
146 | 构建
147 |
148 | ProjectExplorer.BuildSteps.Build
149 |
150 |
151 |
152 | true
153 | Make
154 |
155 | Qt4ProjectManager.MakeStep
156 |
157 | true
158 | clean
159 |
160 |
161 | 1
162 | 清理
163 |
164 | ProjectExplorer.BuildSteps.Clean
165 |
166 | 2
167 | false
168 |
169 | Release
170 |
171 | Qt4ProjectManager.Qt4BuildConfiguration
172 | 0
173 | true
174 |
175 |
176 | G:/QT_source/build-MyMap-Desktop_Qt_5_6_0_MinGW_32bit-Profile
177 |
178 |
179 | true
180 | qmake
181 |
182 | QtProjectManager.QMakeBuildStep
183 | true
184 |
185 | false
186 | true
187 | false
188 |
189 |
190 | true
191 | Make
192 |
193 | Qt4ProjectManager.MakeStep
194 |
195 | false
196 |
197 |
198 |
199 | 2
200 | 构建
201 |
202 | ProjectExplorer.BuildSteps.Build
203 |
204 |
205 |
206 | true
207 | Make
208 |
209 | Qt4ProjectManager.MakeStep
210 |
211 | true
212 | clean
213 |
214 |
215 | 1
216 | 清理
217 |
218 | ProjectExplorer.BuildSteps.Clean
219 |
220 | 2
221 | false
222 |
223 | Profile
224 |
225 | Qt4ProjectManager.Qt4BuildConfiguration
226 | 0
227 | true
228 |
229 | 3
230 |
231 |
232 | 0
233 | 部署
234 |
235 | ProjectExplorer.BuildSteps.Deploy
236 |
237 | 1
238 | 在本地部署
239 |
240 | ProjectExplorer.DefaultDeployConfiguration
241 |
242 | 1
243 |
244 |
245 | false
246 | 1000
247 |
248 | true
249 |
250 | false
251 | false
252 | false
253 | false
254 | true
255 | 0.01
256 | 10
257 | true
258 | 1
259 | 25
260 |
261 | 1
262 | true
263 | false
264 | true
265 | valgrind
266 |
267 | 0
268 | 1
269 | 2
270 | 3
271 | 4
272 | 5
273 | 6
274 | 7
275 | 8
276 | 9
277 | 10
278 | 11
279 | 12
280 | 13
281 | 14
282 |
283 | 2
284 |
285 | MyMap
286 |
287 | Qt4ProjectManager.Qt4RunConfiguration:G:/QT_source/MyMap/MyMap.pro
288 | true
289 |
290 | MyMap.pro
291 | false
292 | false
293 |
294 | 3768
295 | false
296 | true
297 | false
298 | false
299 | true
300 |
301 | 1
302 |
303 |
304 |
305 | ProjectExplorer.Project.TargetCount
306 | 1
307 |
308 |
309 | ProjectExplorer.Project.Updater.FileVersion
310 | 18
311 |
312 |
313 | Version
314 | 18
315 |
316 |
317 |
--------------------------------------------------------------------------------