qlegend.h
125 lines
| 4.2 KiB
| text/x-c
|
CLexer
Miikka Heikkinen
|
r2854 | /**************************************************************************** | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** Copyright (C) 2016 The Qt Company Ltd. | ||
** Contact: https://www.qt.io/licensing/ | ||||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** This file is part of the Qt Charts module of the Qt Toolkit. | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** $QT_BEGIN_LICENSE:GPL$ | ||
Titta Heikkala
|
r2845 | ** Commercial License Usage | ||
** Licensees holding valid commercial Qt licenses may use this file in | ||||
** accordance with the commercial license agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and The Qt Company. For licensing terms | ||||
Miikka Heikkinen
|
r2854 | ** and conditions see https://www.qt.io/terms-conditions. For further | ||
** information use the contact form at https://www.qt.io/contact-us. | ||||
** | ||||
** GNU General Public License Usage | ||||
** Alternatively, this file may be used under the terms of the GNU | ||||
** General Public License version 3 or (at your option) any later version | ||||
** approved by the KDE Free Qt Foundation. The licenses are as published by | ||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||||
** included in the packaging of this file. Please review the following | ||||
** information to ensure the GNU General Public License requirements will | ||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||||
Jani Honkonen
|
r794 | ** | ||
Titta Heikkala
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
Miikka Heikkinen
|
r2854 | ****************************************************************************/ | ||
Jani Honkonen
|
r794 | |||
sauimone
|
r524 | #ifndef QLEGEND_H | ||
#define QLEGEND_H | ||||
Titta Heikkala
|
r2714 | #include <QtCharts/QChartGlobal> | ||
#include <QtWidgets/QGraphicsWidget> | ||||
#include <QtGui/QPen> | ||||
#include <QtGui/QBrush> | ||||
sauimone
|
r524 | |||
Titta Heikkala
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
sauimone
|
r524 | |||
Michal Klocek
|
r790 | class QChart; | ||
Michal Klocek
|
r950 | class QLegendPrivate; | ||
sauimone
|
r2160 | class QLegendMarker; | ||
sauimone
|
r2167 | class QAbstractSeries; | ||
sauimone
|
r524 | |||
Titta Heikkala
|
r2712 | class QT_CHARTS_EXPORT QLegend : public QGraphicsWidget | ||
sauimone
|
r524 | { | ||
Q_OBJECT | ||||
Tero Ahola
|
r1481 | Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) | ||
Tero Ahola
|
r1452 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) | ||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | ||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | ||||
sauimone
|
r1522 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) | ||
sauimone
|
r1527 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | ||
Titta Heikkala
|
r2676 | Q_PROPERTY(bool reverseMarkers READ reverseMarkers WRITE setReverseMarkers NOTIFY reverseMarkersChanged) | ||
Andy Shaw
|
r2864 | Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips NOTIFY showToolTipsChanged) | ||
sauimone
|
r803 | |||
Michal Klocek
|
r790 | private: | ||
explicit QLegend(QChart *chart); | ||||
sauimone
|
r616 | |||
Michal Klocek
|
r790 | public: | ||
Michal Klocek
|
r950 | ~QLegend(); | ||
Marc Mutz
|
r2871 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR); | ||
sauimone
|
r524 | |||
Tero Ahola
|
r737 | void setBrush(const QBrush &brush); | ||
Michal Klocek
|
r645 | QBrush brush() const; | ||
Tero Ahola
|
r1452 | void setColor(QColor color); | ||
QColor color(); | ||||
Michal Klocek
|
r645 | |||
Tero Ahola
|
r737 | void setPen(const QPen &pen); | ||
Michal Klocek
|
r645 | QPen pen() const; | ||
Tero Ahola
|
r1452 | void setBorderColor(QColor color); | ||
QColor borderColor(); | ||||
sauimone
|
r540 | |||
sauimone
|
r1522 | void setFont(const QFont &font); | ||
QFont font() const; | ||||
sauimone
|
r1527 | void setLabelBrush(const QBrush &brush); | ||
QBrush labelBrush() const; | ||||
void setLabelColor(QColor color); | ||||
QColor labelColor() const; | ||||
sauimone
|
r1522 | |||
Tero Ahola
|
r1357 | void setAlignment(Qt::Alignment alignment); | ||
Qt::Alignment alignment() const; | ||||
sauimone
|
r616 | |||
sauimone
|
r799 | void detachFromChart(); | ||
void attachToChart(); | ||||
Michal Klocek
|
r855 | bool isAttachedToChart(); | ||
sauimone
|
r882 | void setBackgroundVisible(bool visible = true); | ||
Michal Klocek
|
r855 | bool isBackgroundVisible() const; | ||
Marc Mutz
|
r2871 | QList <QLegendMarker*> markers(QAbstractSeries *series = Q_NULLPTR) const; | ||
sauimone
|
r2160 | |||
Titta Heikkala
|
r2676 | bool reverseMarkers(); | ||
void setReverseMarkers(bool reverseMarkers = true); | ||||
Andy Shaw
|
r2864 | bool showToolTips() const; | ||
void setShowToolTips(bool show); | ||||
Michal Klocek
|
r855 | protected: | ||
void hideEvent(QHideEvent *event); | ||||
void showEvent(QShowEvent *event); | ||||
sauimone
|
r547 | |||
Tero Ahola
|
r1357 | Q_SIGNALS: | ||
Tero Ahola
|
r1452 | void backgroundVisibleChanged(bool visible); | ||
void colorChanged(QColor color); | ||||
void borderColorChanged(QColor color); | ||||
sauimone
|
r1522 | void fontChanged(QFont font); | ||
sauimone
|
r1527 | void labelColorChanged(QColor color); | ||
Titta Heikkala
|
r2676 | void reverseMarkersChanged(bool reverseMarkers); | ||
Andy Shaw
|
r2864 | void showToolTipsChanged(bool showToolTips); | ||
Tero Ahola
|
r1357 | |||
Michal Klocek
|
r855 | private: | ||
Michal Klocek
|
r950 | QScopedPointer<QLegendPrivate> d_ptr; | ||
Tero Ahola
|
r1452 | Q_DISABLE_COPY(QLegend) | ||
Michal Klocek
|
r950 | friend class LegendScroller; | ||
Michal Klocek
|
r1534 | friend class LegendLayout; | ||
friend class ChartLayout; | ||||
sauimone
|
r2183 | friend class LegendMarkerItem; | ||
sauimone
|
r2194 | friend class QLegendMarkerPrivate; | ||
Michal Klocek
|
r859 | }; | ||
Titta Heikkala
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
sauimone
|
r524 | |||
#endif // QLEGEND_H | ||||