qpielegendmarker.cpp
91 lines
| 2.7 KiB
| text/x-c
|
CppLexer
|
r2162 | /**************************************************************************** | ||
** | ||||
** 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 "qpielegendmarker.h" | ||||
|
r2166 | #include "qpielegendmarker_p.h" | ||
|
r2162 | #include <QPieSeries> | ||
|
r2167 | #include <QDebug> | ||
|
r2162 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r2167 | /* | ||
|
r2162 | QPieLegendMarker::QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent) : | ||
QLegendMarker(series, parent), | ||||
|
r2167 | d_ptr(new QPieLegendMarkerPrivate(series,slice,this)) | ||
|
r2162 | { | ||
|
r2163 | QObject::connect(slice, SIGNAL(labelChanged()), this, SLOT(updated())); | ||
QObject::connect(slice, SIGNAL(brushChanged()), this, SLOT(updated())); | ||||
updated(); | ||||
|
r2162 | } | ||
|
r2167 | */ | ||
QPieLegendMarker::QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject *parent) : | ||||
QLegendMarker(*new QPieLegendMarkerPrivate(series,slice,this), parent) | ||||
{ | ||||
QObject::connect(slice, SIGNAL(labelChanged()), this, SLOT(updated())); | ||||
QObject::connect(slice, SIGNAL(brushChanged()), this, SLOT(updated())); | ||||
// updated(); | ||||
} | ||||
/*! | ||||
\internal | ||||
*/ | ||||
QPieLegendMarker::QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent) : | ||||
QLegendMarker(d, parent) | ||||
|
r2164 | { | ||
} | ||||
|
r2167 | QAbstractSeries* QPieLegendMarker::series() | ||
|
r2163 | { | ||
|
r2167 | Q_D(QPieLegendMarker); | ||
return d->m_series; | ||||
} | ||||
QPieSlice* QPieLegendMarker::peerObject() | ||||
{ | ||||
Q_D(QPieLegendMarker); | ||||
return d->m_slice; | ||||
|
r2163 | } | ||
|
r2162 | |||
|
r2166 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
r2167 | //QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QAbstractSeries *series, QPieLegendMarker *q) : | ||
QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieSeries *series, QPieSlice *slice, QPieLegendMarker *q) : | ||||
QLegendMarkerPrivate(q), | ||||
m_series(series), | ||||
m_slice(slice) | ||||
|
r2166 | { | ||
|
r2167 | qDebug() << "QPieLegendMarkerPrivate created"; | ||
updated(); | ||||
|
r2166 | } | ||
QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate() | ||||
{ | ||||
} | ||||
|
r2167 | void QPieLegendMarkerPrivate::updated() | ||
{ | ||||
m_item->setBrush(m_slice->brush()); | ||||
m_item->setLabel(m_slice->label()); | ||||
} | ||||
|
r2162 | #include "moc_qpielegendmarker.cpp" | ||
|
r2166 | #include "moc_qpielegendmarker_p.cpp" | ||
|
r2162 | |||
QTCOMMERCIALCHART_END_NAMESPACE | ||||