summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mapwidget.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-15 00:54:13 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commitb083795233db702e7cb45b2fe5d6673e7c56e604 (patch)
treec7c8e0abc213bd4adb03d3281ac85353b9308a2c /desktop-widgets/mapwidget.cpp
parent762a9d2ec2aecfa5e6caa7ea5f56ba8c49c3731a (diff)
downloadsubsurface-b083795233db702e7cb45b2fe5d6673e7c56e604.tar.gz
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>
Diffstat (limited to 'desktop-widgets/mapwidget.cpp')
-rw-r--r--desktop-widgets/mapwidget.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
new file mode 100644
index 000000000..2ebc92e0a
--- /dev/null
+++ b/desktop-widgets/mapwidget.cpp
@@ -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;
+}