qbarlegendmarker.cpp
96 lines
| 2.6 KiB
| text/x-c
|
CppLexer
sauimone
|
r2174 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** 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$ | ||||
** | ||||
****************************************************************************/ | ||||
#include "qbarlegendmarker.h" | ||||
#include "qbarlegendmarker_p.h" | ||||
#include <QAbstractBarSeries> | ||||
#include <QBarSet> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
sauimone
|
r2193 | QBarLegendMarker::QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent) : | ||
sauimone
|
r2174 | QLegendMarker(*new QBarLegendMarkerPrivate(this,series,barset,legend), parent) | ||
{ | ||||
} | ||||
QBarLegendMarker::~QBarLegendMarker() | ||||
{ | ||||
} | ||||
/*! | ||||
\internal | ||||
*/ | ||||
QBarLegendMarker::QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent) : | ||||
QLegendMarker(d, parent) | ||||
{ | ||||
} | ||||
QAbstractBarSeries *QBarLegendMarker::series() | ||||
{ | ||||
Q_D(QBarLegendMarker); | ||||
return d->m_series; | ||||
} | ||||
sauimone
|
r2179 | QBarSet* QBarLegendMarker::barset() | ||
sauimone
|
r2174 | { | ||
Q_D(QBarLegendMarker); | ||||
return d->m_barset; | ||||
} | ||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
QBarLegendMarkerPrivate::QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend) : | ||||
QLegendMarkerPrivate(q,legend), | ||||
m_series(series), | ||||
m_barset(barset) | ||||
{ | ||||
QObject::connect(m_barset, SIGNAL(penChanged()), this, SLOT(updated())); | ||||
QObject::connect(m_barset, SIGNAL(labelChanged()), this, SLOT(updated())); | ||||
QObject::connect(m_barset, SIGNAL(brushChanged()), this, SLOT(updated())); | ||||
updated(); | ||||
} | ||||
QBarLegendMarkerPrivate::~QBarLegendMarkerPrivate() | ||||
{ | ||||
} | ||||
sauimone
|
r2182 | QAbstractBarSeries* QBarLegendMarkerPrivate::series() | ||
{ | ||||
return m_series; | ||||
} | ||||
QObject* QBarLegendMarkerPrivate::relatedObject() | ||||
{ | ||||
return m_barset; | ||||
} | ||||
sauimone
|
r2174 | void QBarLegendMarkerPrivate::updated() | ||
{ | ||||
m_item->setPen(m_barset->pen()); | ||||
m_item->setBrush(m_barset->brush()); | ||||
m_item->setLabel(m_barset->label()); | ||||
sauimone
|
r2194 | invalidateLegend(); | ||
sauimone
|
r2174 | } | ||
#include "moc_qbarlegendmarker.cpp" | ||||
#include "moc_qbarlegendmarker_p.cpp" | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||