subsurface/desktop-widgets/mapwidget.cpp
Lubomir I. Ivanov b083795233 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>
2017-07-28 07:31:11 -07:00

27 lines
551 B
C++

#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;
}