Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdeclarativerectanglemapitem_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDECLARATIVERECTANGLEMAPITEM_H_
6#define QDECLARATIVERECTANGLEMAPITEM_H_
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtLocation/private/qlocationglobal_p.h>
20#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
21#include <QtLocation/private/qgeomapitemgeometry_p.h>
22#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
23#include <QtLocation/private/qdeclarativepolygonmapitem_p_p.h>
24#include <QtPositioning/private/qdoublevector2d_p.h>
25
26#include <QSGGeometryNode>
27#include <QSGFlatColorMaterial>
28
29QT_BEGIN_NAMESPACE
30
31class QDeclarativeRectangleMapItemPrivate;
32class Q_LOCATION_EXPORT QDeclarativeRectangleMapItem: public QDeclarativeGeoMapItemBase
33{
34 Q_OBJECT
35 QML_NAMED_ELEMENT(MapRectangle)
36 QML_ADDED_IN_VERSION(5, 0)
37
38 Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged)
39 Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged)
40 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
41 Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
42
43public:
44 explicit QDeclarativeRectangleMapItem(QQuickItem *parent = nullptr);
45 ~QDeclarativeRectangleMapItem() override;
46
47 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
48 //from QuickItem
49 QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *) override;
50
51 QGeoCoordinate topLeft();
52 void setTopLeft(const QGeoCoordinate &center);
53
54 QGeoCoordinate bottomRight();
55 void setBottomRight(const QGeoCoordinate &center);
56
57 QColor color() const;
58 void setColor(const QColor &color);
59
60 QDeclarativeMapLineProperties *border();
61
62 bool contains(const QPointF &point) const override;
63 const QGeoShape &geoShape() const override;
64 void setGeoShape(const QGeoShape &shape) override;
65
66Q_SIGNALS:
67 void topLeftChanged(const QGeoCoordinate &topLeft);
68 void bottomRightChanged(const QGeoCoordinate &bottomRight);
69 void colorChanged(const QColor &color);
70
71protected:
72 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
73 void updatePolish() override;
74
75protected Q_SLOTS:
76 void markSourceDirtyAndUpdate();
77 void onLinePropertiesChanged();
78 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
79
80private:
81 QGeoRectangle m_rectangle;
82 QDeclarativeMapLineProperties m_border;
83 QColor m_color = Qt::transparent;
84
85 bool m_updatingGeometry = false;
86
87 std::unique_ptr<QDeclarativeRectangleMapItemPrivate> m_d;
88
89 friend class QDeclarativeRectangleMapItemPrivate;
90 friend class QDeclarativeRectangleMapItemPrivateCPU;
91};
92
93//////////////////////////////////////////////////////////////////////
94
95QT_END_NAMESPACE
96
97QML_DECLARE_TYPE(QDeclarativeRectangleMapItem)
98
99#endif /* QDECLARATIVERECTANGLEMAPITEM_H_ */
Combined button and popup list for selecting options.