version 2.13.0
add Map library (MapView with OSM maps and items) and mapviewer util
This commit is contained in:
1
libs/map/plugin/CMakeLists.txt
Normal file
1
libs/map/plugin/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qad_plugin(map "Gui;Widgets" "")
|
||||
70
libs/map/plugin/mapplugin.cpp
Normal file
70
libs/map/plugin/mapplugin.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
#include "mapplugin.h"
|
||||
|
||||
#include "mapview.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
MapPlugin::MapPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void MapPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized) return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool MapPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * MapPlugin::createWidget(QWidget * parent) {
|
||||
MapView * w = new MapView(parent);
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::name() const {
|
||||
return QLatin1String("MapView");
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::group() const {
|
||||
return QLatin1String("Display Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon MapPlugin::icon() const {
|
||||
return QIcon("://icons/maps.png");
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::toolTip() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::whatsThis() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
bool MapPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"MapView\" name=\"map\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString MapPlugin::includeFile() const {
|
||||
return QLatin1String("mapview.h");
|
||||
}
|
||||
33
libs/map/plugin/mapplugin.h
Normal file
33
libs/map/plugin/mapplugin.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef MAPPLUGIN_H
|
||||
#define MAPPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
|
||||
|
||||
class MapPlugin
|
||||
: public QObject
|
||||
, public QDesignerCustomWidgetInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
explicit MapPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
13
libs/map/plugin/mapview_designerplugin.cpp
Normal file
13
libs/map/plugin/mapview_designerplugin.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "mapview_designerplugin.h"
|
||||
|
||||
#include "mapplugin.h"
|
||||
|
||||
|
||||
MapDesignerPlugin::MapDesignerPlugin(QObject * parent): QObject(parent) {
|
||||
m_widgets.append(new MapPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
QList<QDesignerCustomWidgetInterface *> MapDesignerPlugin::customWidgets() const {
|
||||
return m_widgets;
|
||||
}
|
||||
23
libs/map/plugin/mapview_designerplugin.h
Normal file
23
libs/map/plugin/mapview_designerplugin.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef MAP_DESIGNERPLUGIN_H
|
||||
#define MAP_DESIGNERPLUGIN_H
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtDesigner/QtDesigner>
|
||||
|
||||
|
||||
class MapDesignerPlugin
|
||||
: public QObject
|
||||
, public QDesignerCustomWidgetCollectionInterface {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "qad.map")
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
MapDesignerPlugin(QObject * parent = 0);
|
||||
virtual QList<QDesignerCustomWidgetInterface *> customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface *> m_widgets;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user