1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QTGRAPHS_QCUSTOMLABELITEM_H
5#define QTGRAPHS_QCUSTOMLABELITEM_H
6
7#include <QtGraphs/qcustom3ditem.h>
8#include <QtGraphs/qgraphsglobal.h>
9#include <QtGui/qcolor.h>
10#include <QtGui/qfont.h>
11#include <QtGui/qquaternion.h>
12#include <QtGui/qvector3d.h>
13
14QT_BEGIN_NAMESPACE
15
16class QCustom3DLabelPrivate;
17
18class Q_GRAPHS_EXPORT QCustom3DLabel : public QCustom3DItem
19{
20 Q_OBJECT
21 Q_DECLARE_PRIVATE(QCustom3DLabel)
22 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
23 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
24 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged FINAL)
25 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY
26 backgroundColorChanged FINAL)
27 Q_PROPERTY(bool borderVisible READ isBorderVisible WRITE setBorderVisible NOTIFY
28 borderVisibleChanged FINAL)
29 Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY
30 backgroundVisibleChanged FINAL)
31 Q_PROPERTY(bool facingCamera READ isFacingCamera WRITE setFacingCamera NOTIFY
32 facingCameraChanged FINAL)
33 QML_NAMED_ELEMENT(Custom3DLabel)
34
35public:
36 explicit QCustom3DLabel(QObject *parent = nullptr);
37 explicit QCustom3DLabel(const QString &text,
38 const QFont &font,
39 QVector3D position,
40 QVector3D scaling,
41 const QQuaternion &rotation,
42 QObject *parent = nullptr);
43 ~QCustom3DLabel() override;
44
45 void setText(const QString &text);
46 QString text() const;
47
48 void setFont(const QFont &font);
49 QFont font() const;
50
51 void setTextColor(QColor color);
52 QColor textColor() const;
53
54 void setBackgroundColor(QColor color);
55 QColor backgroundColor() const;
56
57 void setBorderVisible(bool visible);
58 bool isBorderVisible() const;
59
60 void setBackgroundVisible(bool visible);
61 bool isBackgroundVisible() const;
62
63 void setFacingCamera(bool enabled);
64 bool isFacingCamera() const;
65
66Q_SIGNALS:
67 void textChanged(const QString &text);
68 void fontChanged(const QFont &font);
69 void textColorChanged(QColor color);
70 void backgroundColorChanged(QColor color);
71 void borderVisibleChanged(bool visible);
72 void backgroundVisibleChanged(bool visible);
73 void facingCameraChanged(bool enabled);
74
75private:
76 Q_DISABLE_COPY(QCustom3DLabel)
77};
78
79QT_END_NAMESPACE
80
81#endif
82

source code of qtgraphs/src/graphs3d/data/qcustom3dlabel.h