From b083795233db702e7cb45b2fe5d6673e7c56e604 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 15 Jul 2017 00:54:13 +0300 Subject: 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 --- desktop-widgets/mapwidget.cpp | 27 +++++++++++++++++++++++++++ desktop-widgets/mapwidget.h | 23 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 desktop-widgets/mapwidget.cpp create mode 100644 desktop-widgets/mapwidget.h (limited to 'desktop-widgets') 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 +#include +#include + +#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(rootObject()); +} + +MapWidget::~MapWidget() +{ + m_instance = NULL; +} + +MapWidget *MapWidget::instance() +{ + if (m_instance == NULL) + m_instance = new MapWidget(); + return m_instance; +} diff --git a/desktop-widgets/mapwidget.h b/desktop-widgets/mapwidget.h new file mode 100644 index 000000000..c1d55ae91 --- /dev/null +++ b/desktop-widgets/mapwidget.h @@ -0,0 +1,23 @@ +#ifndef MAPWIDGET_H +#define MAPWIDGET_H + +#include + +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 -- cgit v1.2.3-70-g09d2