diff options
Diffstat (limited to 'desktop-widgets/mapwidget.cpp')
-rw-r--r-- | desktop-widgets/mapwidget.cpp | 27 |
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;
+}
|