In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Qt how to write map miniblink kernel", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Qt how to write map miniblink kernel" bar!
I. Preface
In the process of using Qt as a project, when you encounter projects that need browser controls, you may not be able to avoid a problem, that is, starting from the Qt5.6 version, the Qt build suite of the mingw compiler no longer provides browser controls, and previously you can use webkit controls, so many projects either choose version 5.6 or msvc build suites, and most msvc build suites do not have their own browser controls. You also need to compile by yourself. Only the original build suite such as Qt5.9+VS2015 and Qt5.12+VS2017 can have browser controls, otherwise even if you check the browser controls, they will not be installed. This will make many projects that rely on browser controls more passive, so you must find a lightweight browser control to replace them, such as cef and miniblink. Individuals prefer miniblink, and the use is extremely simple. Relying on extremely compact dll, qt will always have browser controls on linux and mac systems, so it does not involve cross-platform problems, so the disadvantage of miniblink's temporary support for windows is not a disadvantage.
Miniblink is an extremely compact browser kernel project, the third most popular browser kernel control in the world. Based on the latest version of the chromium kernel, it removes all redundant parts of chromium and retains only the most basic typesetting engine, blink. Miniblink maintains a minimalist size of about 10m, which is the smallest of all similar products, and supports windows xp and npapi. The author of miniblink is very powerful. QQ is nicknamed the floor-sweeping monk, just like the floor-sweeping monk in The Demi-Gods & Semi-Devils, extremely secret and highly skilled in martial arts, proficient in all kinds of stunts.
Steps for qt+miniblink usage:
Step 1: call the wkeSetWkeDllPath function to load the dll file path, and a project only needs to be executed once.
Step 2: call wkeInitialize to initialize the dynamic library, and a project only needs to be executed once.
Step 3: call wkeCreateWebWindow to create a browser control, passing in a handle.
Step 4: call wkeOnLoadingFinish registration callback to load the completion signal, and register only if necessary.
Step 5: call the method of wkeJsBindFunction registration callback to receive data, which must be executed here before the page is loaded.
Step 6: call wkeLoadURL to load the URL, wkeLoadFile to load the web file, and wkeLoadHtmlWithBaseUrl to load the web content.
Step 7: call wkeRunJS to execute the js function, which is super simple.
Step 8: call wkeFinalize to release resources, only once, at the end of the entire project.
II. Functional features
Both online map and offline map modes are supported.
It also supports webkit kernel, webengine kernel, miniblink kernel and IE kernel.
Multiple dimension points can be set, including name, address, longitude and latitude.
You can set whether the map can be clicked, dragged, or scrolled.
You can set the protocol version, secret key, theme style, central coordinates, central city, geocoding location, and so on.
Can set the map zoom scale and level, thumbnails, scale, road information and other controls visible.
Support map interaction, such as mouse press to get the latitude and longitude of the corresponding location.
Support to query the route, you can set the starting point, end point, route mode, route mode, route scheme (minimum time, least transfer, least walk, do not take the subway, shortest distance, avoid highway).
Can display dots, lines and surfaces tools, and can draw lines, points, rectangles, circles and so on directly on the map.
Administrative divisions can be set up, a certain urban area drawing layer can be specified, and the online map automatically outputs the administrative division boundary points to the js file for offline map use.
Multiple coverings can be added statically or dynamically. Support points, broken lines, polygons, rectangles, circles, arcs, point aggregations, etc.
Provides a function interface to handle latitude and longitude resolution to address and address resolution to latitude and longitude coordinates.
The demo provided can be directly selected to perform corresponding processing such as route query.
You can get the collection of point coordinate information queried by the route, such as for robot coordinate navigation.
Encapsulates a wealth of functions such as deleting specified points and all points, deleting specified coverings and all coverings, etc.
Callout point pop-up box information can be customized in standard html format.
Dimension point click event optional 0-do not process 1-own pop-up box 2-send a signal.
Dimension points can be animated 0-do not process 1-Jump 2-fall
Dimension points can be set up local picture files and so on.
The function interface is friendly and unified, and it is easy to use, just one class.
Support js dynamic interaction to add points, delete points, clear points, reset points, no need to refresh the page.
Support any Qt version, any system, any compiler.
Third, effect picture
4. Related code # ifndef MINIBLINK_H#define MINIBLINK_H#include # include "wke.h" class miniblink: public QWidget {Q_OBJECTpublic: explicit miniblink (QWidget * parent = 0); / / initialize resource static void init (); / / release resource static void release (); protected: / / set browser control to automatically adapt to size void resizeEvent (QResizeEvent *); private: / / browser control object wkeWebView webView Signals: / / Web page loading completed void loadFinished (bool ok); / / received data from the web page void receiveDataFromJs (const QString & type, const QVariant & data); public: / / returned function void loadFinish (bool ok); void receiveData (const QString & type, const QVariant & data); public slots: / / load URL or local file void load (const QString & url, bool file = false) / load html content void setHtml (const QString & html, const QString & baseUrl); / / execute js function void runJs (const QString & js);}; # endif / / MINIBLINK_H#include "miniblink.h" # include "qapplication.h" # include "qdebug.h" void onLoadingFinish (wkeWebView, void * param, const wkeString, wkeLoadingResult result, const wkeString) {/ / qDebug () receiveData (type, data); return jsUndefined () } miniblink::miniblink (QWidget * parent): QWidget (parent) {/ / the first step initializes the dynamic library init (); / / the second step initializes the browser control / / create a browser control and place the handle webView = wkeCreateWebWindow (WKE_WINDOW_TYPE_CONTROL, (HWND) this- > winId (), 0,0, this- > width (), this- > height ()); / / Association completion signal wkeOnLoadingFinish (webView, onLoadingFinish, this) / / set the browser control to see wkeShowWindow (webView, TRUE); / / register the general method of receiving data. Be sure to wkeJsBindFunction ("objName_receiveData", objName_receiveData, this, 2) before the web page is loaded;} void miniblink::init () {/ / Global only needs to initialize static bool isInit = false; if (! isInit) {isInit = true / / load different dynamic libraries # ifdef Q_OS_WIN64 QString file = qApp- > applicationDirPath () + "/ miniblink_64.dll"; # else QString file = qApp- > applicationDirPath () + "/ miniblink.dll"; # endif const wchar_t * path = reinterpret_cast (file.utf16 ()); wkeSetWkeDllPath (path); bool ok = wkeInitialize () QDebug () width (), this- > height ();} void miniblink::loadFinish (bool ok) {emit loadFinished (ok);} void miniblink::receiveData (const QString & type, const QVariant & data) {emit receiveDataFromJs (type, data);} void miniblink::load (const QString & url, bool file) {const char * temp = url.toLocal8Bit () data (); if (file) {wkeLoadFile (webView, temp) } else {wkeLoadURL (webView, temp);}} void miniblink::setHtml (const QString & html, const QString & baseUrl) {wkeLoadHtmlWithBaseUrl (webView, html.toLocal8Bit (). Data (), baseUrl.toLocal8Bit (). Data ());} void miniblink::runJs (const QString & js) {wkeRunJS (webView, js.toLocal8Bit (). Data ()) } Thank you for reading, the above is the content of "how to write map miniblink kernel in Qt". After the study of this article, I believe you have a deeper understanding of how to write map miniblink kernel in Qt, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.