1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef QCUSTOMLABELITEM_H
31#define QCUSTOMLABELITEM_H
32
33#include <QtDataVisualization/qdatavisualizationglobal.h>
34#include <QtDataVisualization/QCustom3DItem>
35#include <QtGui/QVector3D>
36#include <QtGui/QQuaternion>
37#include <QtGui/QFont>
38#include <QtGui/QColor>
39
40QT_BEGIN_NAMESPACE_DATAVISUALIZATION
41
42class QCustom3DLabelPrivate;
43
44class QT_DATAVISUALIZATION_EXPORT QCustom3DLabel : public QCustom3DItem
45{
46 Q_OBJECT
47 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
48 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
49 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
50 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
51 Q_PROPERTY(bool borderEnabled READ isBorderEnabled WRITE setBorderEnabled NOTIFY borderEnabledChanged)
52 Q_PROPERTY(bool backgroundEnabled READ isBackgroundEnabled WRITE setBackgroundEnabled NOTIFY backgroundEnabledChanged)
53 Q_PROPERTY(bool facingCamera READ isFacingCamera WRITE setFacingCamera NOTIFY facingCameraChanged)
54
55public:
56 explicit QCustom3DLabel(QObject *parent = nullptr);
57 explicit QCustom3DLabel(const QString &text, const QFont &font, const QVector3D &position,
58 const QVector3D &scaling, const QQuaternion &rotation,
59 QObject *parent = nullptr);
60 virtual ~QCustom3DLabel();
61
62 void setText(const QString &text);
63 QString text() const;
64
65 void setFont(const QFont &font);
66 QFont font() const;
67
68 void setTextColor(const QColor &color);
69 QColor textColor() const;
70
71 void setBackgroundColor(const QColor &color);
72 QColor backgroundColor() const;
73
74 void setBorderEnabled(bool enabled);
75 bool isBorderEnabled() const;
76
77 void setBackgroundEnabled(bool enabled);
78 bool isBackgroundEnabled() const;
79
80 void setFacingCamera(bool enabled);
81 bool isFacingCamera() const;
82
83Q_SIGNALS:
84 void textChanged(const QString &text);
85 void fontChanged(const QFont &font);
86 void textColorChanged(const QColor &color);
87 void backgroundColorChanged(const QColor &color);
88 void borderEnabledChanged(bool enabled);
89 void backgroundEnabledChanged(bool enabled);
90 void facingCameraChanged(bool enabled);
91
92protected:
93 QCustom3DLabelPrivate *dptr();
94 const QCustom3DLabelPrivate *dptrc() const;
95
96private:
97 Q_DISABLE_COPY(QCustom3DLabel)
98
99 friend class Abstract3DRenderer;
100};
101
102QT_END_NAMESPACE_DATAVISUALIZATION
103
104#endif
105