| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTDATAVIS3D_QCUSTOMLABELITEM_H |
| 5 | #define QTDATAVIS3D_QCUSTOMLABELITEM_H |
| 6 | |
| 7 | #include <QtDataVisualization/qdatavisualizationglobal.h> |
| 8 | #include <QtDataVisualization/QCustom3DItem> |
| 9 | #include <QtGui/QVector3D> |
| 10 | #include <QtGui/QQuaternion> |
| 11 | #include <QtGui/QFont> |
| 12 | #include <QtGui/QColor> |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class QCustom3DLabelPrivate; |
| 17 | |
| 18 | class Q_DATAVISUALIZATION_EXPORT QCustom3DLabel : public QCustom3DItem |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) |
| 22 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) |
| 23 | Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged) |
| 24 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) |
| 25 | Q_PROPERTY(bool borderEnabled READ isBorderEnabled WRITE setBorderEnabled NOTIFY borderEnabledChanged) |
| 26 | Q_PROPERTY(bool backgroundEnabled READ isBackgroundEnabled WRITE setBackgroundEnabled NOTIFY backgroundEnabledChanged) |
| 27 | Q_PROPERTY(bool facingCamera READ isFacingCamera WRITE setFacingCamera NOTIFY facingCameraChanged) |
| 28 | |
| 29 | public: |
| 30 | explicit QCustom3DLabel(QObject *parent = nullptr); |
| 31 | explicit QCustom3DLabel(const QString &text, const QFont &font, const QVector3D &position, |
| 32 | const QVector3D &scaling, const QQuaternion &rotation, |
| 33 | QObject *parent = nullptr); |
| 34 | virtual ~QCustom3DLabel(); |
| 35 | |
| 36 | void setText(const QString &text); |
| 37 | QString text() const; |
| 38 | |
| 39 | void setFont(const QFont &font); |
| 40 | QFont font() const; |
| 41 | |
| 42 | void setTextColor(const QColor &color); |
| 43 | QColor textColor() const; |
| 44 | |
| 45 | void setBackgroundColor(const QColor &color); |
| 46 | QColor backgroundColor() const; |
| 47 | |
| 48 | void setBorderEnabled(bool enabled); |
| 49 | bool isBorderEnabled() const; |
| 50 | |
| 51 | void setBackgroundEnabled(bool enabled); |
| 52 | bool isBackgroundEnabled() const; |
| 53 | |
| 54 | void setFacingCamera(bool enabled); |
| 55 | bool isFacingCamera() const; |
| 56 | |
| 57 | Q_SIGNALS: |
| 58 | void textChanged(const QString &text); |
| 59 | void fontChanged(const QFont &font); |
| 60 | void textColorChanged(const QColor &color); |
| 61 | void backgroundColorChanged(const QColor &color); |
| 62 | void borderEnabledChanged(bool enabled); |
| 63 | void backgroundEnabledChanged(bool enabled); |
| 64 | void facingCameraChanged(bool enabled); |
| 65 | |
| 66 | protected: |
| 67 | QCustom3DLabelPrivate *dptr(); |
| 68 | const QCustom3DLabelPrivate *dptrc() const; |
| 69 | |
| 70 | private: |
| 71 | Q_DISABLE_COPY(QCustom3DLabel) |
| 72 | |
| 73 | friend class Abstract3DRenderer; |
| 74 | }; |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif |
| 79 |
