mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
map: add placeholder .cpp and .h files for the new map widget
The files are WIP and located in desktop-widgets, as these would only be used by the desktop version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
762a9d2ec2
commit
b083795233
2 changed files with 50 additions and 0 deletions
27
desktop-widgets/mapwidget.cpp
Normal file
27
desktop-widgets/mapwidget.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <QQmlContext>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QQuickItem>
|
||||||
|
|
||||||
|
#include "mapwidget.h"
|
||||||
|
|
||||||
|
MapWidget *MapWidget::m_instance = NULL;
|
||||||
|
|
||||||
|
MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
|
||||||
|
{
|
||||||
|
setSource(QUrl(QStringLiteral("qrc:/mapwidget-qml")));
|
||||||
|
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
|
||||||
|
m_rootItem = qobject_cast<QQuickItem *>(rootObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
MapWidget::~MapWidget()
|
||||||
|
{
|
||||||
|
m_instance = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapWidget *MapWidget::instance()
|
||||||
|
{
|
||||||
|
if (m_instance == NULL)
|
||||||
|
m_instance = new MapWidget();
|
||||||
|
return m_instance;
|
||||||
|
}
|
23
desktop-widgets/mapwidget.h
Normal file
23
desktop-widgets/mapwidget.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef MAPWIDGET_H
|
||||||
|
#define MAPWIDGET_H
|
||||||
|
|
||||||
|
#include <QQuickWidget>
|
||||||
|
|
||||||
|
class QResizeEvent;
|
||||||
|
class QQuickItem;
|
||||||
|
|
||||||
|
class MapWidget : public QQuickWidget {
|
||||||
|
|
||||||
|
public:
|
||||||
|
MapWidget(QWidget *parent = NULL);
|
||||||
|
~MapWidget();
|
||||||
|
|
||||||
|
static MapWidget *instance();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static MapWidget *m_instance;
|
||||||
|
QQuickItem *m_rootItem;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAPWIDGET_H
|
Loading…
Add table
Add a link
Reference in a new issue