qlegend.h
107 lines
| 3.1 KiB
| text/x-c
|
CLexer
|
r794 | /**************************************************************************** | ||
** | ||||
|
r2432 | ** Copyright (C) 2013 Digia Plc | ||
|
r794 | ** All rights reserved. | ||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
|
r2574 | ** This file is part of the Qt Enterprise Charts Add-on. | ||
|
r794 | ** | ||
** $QT_BEGIN_LICENSE$ | ||||
|
r2574 | ** Licensees holding valid Qt Enterprise licenses may use this file in | ||
** accordance with the Qt Enterprise License Agreement provided with the | ||||
|
r794 | ** Software or, alternatively, in accordance with the terms contained in | ||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r524 | #ifndef QLEGEND_H | ||
#define QLEGEND_H | ||||
|
r1836 | #include <qchartglobal.h> | ||
|
r790 | #include <QGraphicsWidget> | ||
|
r762 | #include <QPen> | ||
#include <QBrush> | ||||
|
r524 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r790 | class QChart; | ||
|
r950 | class QLegendPrivate; | ||
|
r2160 | class QLegendMarker; | ||
|
r2167 | class QAbstractSeries; | ||
|
r524 | |||
|
r790 | class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsWidget | ||
|
r524 | { | ||
Q_OBJECT | ||||
|
r1481 | Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) | ||
|
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) | ||||
|
r1522 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) | ||
|
r1527 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | ||
|
r803 | |||
|
r790 | private: | ||
explicit QLegend(QChart *chart); | ||||
|
r616 | |||
|
r790 | public: | ||
|
r950 | ~QLegend(); | ||
|
r524 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
|
r737 | void setBrush(const QBrush &brush); | ||
|
r645 | QBrush brush() const; | ||
|
r1452 | void setColor(QColor color); | ||
QColor color(); | ||||
|
r645 | |||
|
r737 | void setPen(const QPen &pen); | ||
|
r645 | QPen pen() const; | ||
|
r1452 | void setBorderColor(QColor color); | ||
QColor borderColor(); | ||||
|
r540 | |||
|
r1522 | void setFont(const QFont &font); | ||
QFont font() const; | ||||
|
r1527 | void setLabelBrush(const QBrush &brush); | ||
QBrush labelBrush() const; | ||||
void setLabelColor(QColor color); | ||||
QColor labelColor() const; | ||||
|
r1522 | |||
|
r1357 | void setAlignment(Qt::Alignment alignment); | ||
Qt::Alignment alignment() const; | ||||
|
r616 | |||
|
r799 | void detachFromChart(); | ||
void attachToChart(); | ||||
|
r855 | bool isAttachedToChart(); | ||
|
r882 | void setBackgroundVisible(bool visible = true); | ||
|
r855 | bool isBackgroundVisible() const; | ||
|
r2193 | QList <QLegendMarker*> markers(QAbstractSeries *series = 0) const; | ||
|
r2160 | |||
|
r855 | protected: | ||
void hideEvent(QHideEvent *event); | ||||
void showEvent(QShowEvent *event); | ||||
|
r547 | |||
|
r1357 | Q_SIGNALS: | ||
|
r1452 | void backgroundVisibleChanged(bool visible); | ||
void colorChanged(QColor color); | ||||
void borderColorChanged(QColor color); | ||||
|
r1522 | void fontChanged(QFont font); | ||
|
r1527 | void labelColorChanged(QColor color); | ||
|
r1357 | |||
|
r855 | private: | ||
|
r950 | QScopedPointer<QLegendPrivate> d_ptr; | ||
|
r1452 | Q_DISABLE_COPY(QLegend) | ||
|
r950 | friend class LegendScroller; | ||
|
r1534 | friend class LegendLayout; | ||
friend class ChartLayout; | ||||
|
r2183 | friend class LegendMarkerItem; | ||
|
r2194 | friend class QLegendMarkerPrivate; | ||
|
r859 | }; | ||
|
r524 | QTCOMMERCIALCHART_END_NAMESPACE | ||
#endif // QLEGEND_H | ||||