Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize Adaptive stretching of Qt Map

Shulou Source: shulou.com Published: 2022-06-02 05:59:25 10月03日 Update

Editor to share with you how to achieve Qt map adaptive stretching, I hope you have something to gain after reading this article, let's discuss it together!

I. Preface

People who have used echart will encounter a problem, even if _ window.onresize = echart.resize is written in the code, it is only horizontally adaptively stretching to fill the page, and the vertical direction will not change unless you specify a height, which is more depressing, why is echart itself not adaptive? According to reason, it should not be ah, is it very difficult to achieve? All right, forget about this. There are a lot of solutions to this problem, and there are also this problem in Qt browser controls. In order to solve this problem, I think of two strategies: one is that the program itself detects the size change, and then resets the height and loads it into the web page; the other is that the js function sets the corresponding width and height. When is it executed, that is, when the interface size of the program changes, the two methods are compared. The final choice of the latter, because the effect is better, it is executed asynchronously, and there is no need to reload the web page. The method of reloading the web page every time the height changes has been used in early works, and it looks stupid.

II. Functional features

At the same time, support flicker point map, migration map, area map, dashboard and so on.

You can set various colors such as title, prompt, background color, text color, line color, area color, and so on.

You can set the name, value, longitude and latitude collection of the city.

You can set the magnification of the map and whether the mouse wheel is allowed to zoom.

Built-in world map, national map, provincial map, regional map, can be accurate to the county, all maps are used offline.

Built-in provincial and municipal json data file to js file function, if there is a data update self-conversion, support a single file conversion and one-click conversion of all files.

Built-in function to obtain all the names and longitude and latitude information sets of the region from json files or js files, which can be used to display the information obtained by this method.

Depending on the browser component to display the map, the provided demo supports webkit, webengine and ie to load web pages.

Strong expansibility, you can add a variety of exquisite echarts components according to the gourd painting ladle to make a great effect.

The built-in dashboard components provide interactive functionality, and the corresponding code is included in the demo demo.

The function interface is friendly and unified, and it is easy to use, just one class.

Support any Qt version, any system, any compiler.

Third, experience address

Experience address: https://pan.baidu.com/s/1Ie1xGLv7tSL-9vfsv28w1Q extraction code: wf4f file name: bin_map.zip

Domestic site: https://gitee.com/feiyangqingyun

International site: https://github.com/feiyangqingyun

4. Effect picture

Fifth, the relevant code / / set window size changes echarts automatic stretch fill, this method can only stretch list height ()); webView- > page ()-> runJavaScript (js); # endif}} read this article, I believe you "how to achieve Qt map adaptive stretching" have a certain understanding, if you want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

Tags: Maps files colors functions web pages problems heights changes support code information effects components instruments functions methods areas names addresses dimensions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Redmi MySQL NVidia