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
qdeclarativegeomapcopyrightsnotice_p.h
Go to the documentation of this file.
1// Copyright (C) 2014 Aaron McCarthy <mccarthy.aaron@gmail.com>
2// Copyright (C) 2022 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_H
6#define QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_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
21#include <QtGui/QImage>
22#include <QPointer>
23#include <QtQuick/QQuickPaintedItem>
24
25Q_MOC_INCLUDE(<QtLocation/private/qdeclarativegeomap_p.h>)
26
27
28QT_BEGIN_NAMESPACE
29
30class QTextDocument;
31class QDeclarativeGeoMap;
33class Q_LOCATION_EXPORT QDeclarativeGeoMapCopyrightNotice : public QQuickPaintedItem
34{
35 Q_OBJECT
36 QML_NAMED_ELEMENT(MapCopyrightNotice)
37 QML_ADDED_IN_VERSION(5, 0)
38
39 Q_PROPERTY(QDeclarativeGeoMap *mapSource READ mapSource WRITE setMapSource NOTIFY mapSourceChanged)
40 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet NOTIFY styleSheetChanged)
41
42public:
43 QDeclarativeGeoMapCopyrightNotice(QQuickItem *parent = nullptr);
44 ~QDeclarativeGeoMapCopyrightNotice();
45
46 void setCopyrightsZ(qreal copyrightsZ);
47
48 void setCopyrightsVisible(bool visible);
49 bool copyrightsVisible() const;
50 void anchorToBottomLeft();
51
52 void setMapSource(QDeclarativeGeoMap *mapSource);
53 QDeclarativeGeoMap *mapSource();
54
55 QString styleSheet() const;
56 void setStyleSheet(const QString &styleSheet);
57
58public Q_SLOTS:
59 void copyrightsImageChanged(const QImage &copyrightsImage);
60 void copyrightsChanged(const QString &copyrightsHtml);
61 void onCopyrightsStyleSheetChanged(const QString &styleSheet);
62
63signals:
64 void linkActivated(const QString &link);
65 void mapSourceChanged();
66 void backgroundColorChanged(const QColor &color);
67 void styleSheetChanged(const QString &styleSheet);
68 void copyrightsVisibleChanged();
69
70protected:
71 void paint(QPainter *painter) override;
72 void mousePressEvent(QMouseEvent *event) override;
73 void mouseReleaseEvent(QMouseEvent *event) override;
74 void rasterizeHtmlAndUpdate();
75 void connectMap();
76
77private:
78 void createCopyright();
79
80 QTextDocument *m_copyrightsHtml = nullptr;
81 QString m_html;
82 QImage m_copyrightsImage;
83 QString m_activeAnchor;
84 bool m_copyrightsVisible = true;
85 QPointer<QDeclarativeGeoMap> m_mapSource;
86 QColor m_backgroundColor;
87 QString m_styleSheet;
88 bool m_userDefinedStyleSheet = false;
89
90 Q_DISABLE_COPY(QDeclarativeGeoMapCopyrightNotice)
91 Q_DECLARE_PRIVATE(QDeclarativeGeoMapCopyrightNotice)
92};
93
94QT_END_NAMESPACE
95
96#endif
#define M_PI
Definition qmath.h:200