1/****************************************************************************
2**
3** Copyright (C) 2014 Aaron McCarthy <mccarthy.aaron@gmail.com>
4** Copyright (C) 2015 The Qt Company Ltd.
5** Contact: http://www.qt.io/licensing/
6**
7** This file is part of the QtLocation module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL3$
10** Commercial License Usage
11** Licensees holding valid commercial Qt licenses may use this file in
12** accordance with the commercial license agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and The Qt Company. For licensing terms
15** and conditions see http://www.qt.io/terms-conditions. For further
16** information use the contact form at http://www.qt.io/contact-us.
17**
18** GNU Lesser General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU Lesser
20** General Public License version 3 as published by the Free Software
21** Foundation and appearing in the file LICENSE.LGPLv3 included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU Lesser General Public License version 3 requirements
24** will be met: https://www.gnu.org/licenses/lgpl.html.
25**
26** GNU General Public License Usage
27** Alternatively, this file may be used under the terms of the GNU
28** General Public License version 2.0 or later as published by the Free
29** Software Foundation and appearing in the file LICENSE.GPL included in
30** the packaging of this file. Please review the following information to
31** ensure the GNU General Public License version 2.0 requirements will be
32** met: http://www.gnu.org/licenses/gpl-2.0.html.
33**
34** $QT_END_LICENSE$
35**
36****************************************************************************/
37
38#ifndef QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_H
39#define QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_H
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists purely as an
46// implementation detail. This header file may change from version to
47// version without notice, or even be removed.
48//
49// We mean it.
50//
51
52#include <QtLocation/private/qlocationglobal_p.h>
53
54#include <QtGui/QImage>
55#include <QPointer>
56#include <QtQuick/QQuickPaintedItem>
57
58QT_BEGIN_NAMESPACE
59
60class QTextDocument;
61class QDeclarativeGeoMap;
62class QDeclarativeGeoMapCopyrightNoticePrivate;
63class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapCopyrightNotice : public QQuickPaintedItem
64{
65 Q_OBJECT
66 Q_PROPERTY(QDeclarativeGeoMap *mapSource READ mapSource WRITE setMapSource NOTIFY mapSourceChanged)
67 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet NOTIFY styleSheetChanged)
68
69public:
70 QDeclarativeGeoMapCopyrightNotice(QQuickItem *parent = nullptr);
71 ~QDeclarativeGeoMapCopyrightNotice();
72
73 void setCopyrightsZ(qreal copyrightsZ);
74
75 void setCopyrightsVisible(bool visible);
76 bool copyrightsVisible() const;
77 void anchorToBottomLeft();
78
79 void setMapSource(QDeclarativeGeoMap *mapSource);
80 QDeclarativeGeoMap *mapSource();
81
82 QString styleSheet() const;
83 void setStyleSheet(const QString &styleSheet);
84
85public Q_SLOTS:
86 void copyrightsChanged(const QImage &copyrightsImage);
87 void copyrightsChanged(const QString &copyrightsHtml);
88 void onCopyrightsStyleSheetChanged(const QString &styleSheet);
89
90signals:
91 void linkActivated(const QString &link);
92 void mapSourceChanged();
93 void backgroundColorChanged(const QColor &color);
94 void styleSheetChanged(const QString &styleSheet);
95 void copyrightsVisibleChanged();
96
97protected:
98 void paint(QPainter *painter) override;
99 void mousePressEvent(QMouseEvent *event) override;
100 void mouseReleaseEvent(QMouseEvent *event) override;
101 void rasterizeHtmlAndUpdate();
102 void connectMap();
103
104private:
105 void createCopyright();
106
107 QTextDocument *m_copyrightsHtml;
108 QString m_html;
109 QImage m_copyrightsImage;
110 QString m_activeAnchor;
111 bool m_copyrightsVisible;
112 QPointer<QDeclarativeGeoMap> m_mapSource;
113 QColor m_backgroundColor;
114 QString m_styleSheet;
115 bool m_userDefinedStyleSheet;
116
117 Q_DISABLE_COPY(QDeclarativeGeoMapCopyrightNotice)
118 Q_DECLARE_PRIVATE(QDeclarativeGeoMapCopyrightNotice)
119};
120
121QT_END_NAMESPACE
122
123#endif
124

source code of qtlocation/src/location/declarativemaps/qdeclarativegeomapcopyrightsnotice_p.h