qlegendmarker.cpp
120 lines
| 2.7 KiB
| text/x-c
|
CppLexer
|
r2160 | /**************************************************************************** | ||
** | ||||
** 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 "qlegendmarker.h" | ||||
|
r2163 | #include "qlegendmarker_p.h" | ||
|
r2164 | #include "legendmarkeritem_p.h" | ||
|
r2171 | #include "qlegend.h" | ||
|
r2160 | #include <QDebug> | ||
|
r2163 | #include <QFontMetrics> | ||
|
r2169 | #include <QGraphicsSceneEvent> | ||
|
r2182 | #include <QAbstractSeries> | ||
|
r2160 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r2174 | |||
|
r2167 | QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) : | ||
QObject(parent), | ||||
d_ptr(&d) | ||||
{ | ||||
|
r2182 | d_ptr->m_item->setVisible(d_ptr->series()->isVisible()); | ||
|
r2167 | } | ||
|
r2160 | |||
QLegendMarker::~QLegendMarker() | ||||
{ | ||||
} | ||||
QString QLegendMarker::label() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->label(); | ||
|
r2160 | } | ||
void QLegendMarker::setLabel(const QString &label) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setLabel(label); | ||
|
r2163 | } | ||
QBrush QLegendMarker::labelBrush() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->brush(); | ||
|
r2163 | } | ||
void QLegendMarker::setLabelBrush(const QBrush &brush) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setLabelBrush(brush); | ||
|
r2163 | } | ||
QFont QLegendMarker::font() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->font(); | ||
|
r2163 | } | ||
void QLegendMarker::setFont(const QFont &font) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setFont(font); | ||
|
r2160 | } | ||
QPen QLegendMarker::pen() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->pen(); | ||
|
r2160 | } | ||
void QLegendMarker::setPen(const QPen &pen) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setPen(pen); | ||
|
r2160 | } | ||
QBrush QLegendMarker::brush() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->brush(); | ||
|
r2160 | } | ||
void QLegendMarker::setBrush(const QBrush &brush) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setBrush(brush); | ||
|
r2160 | } | ||
bool QLegendMarker::isVisible() const | ||||
{ | ||||
|
r2174 | return d_ptr->m_item->isVisible(); | ||
|
r2160 | } | ||
void QLegendMarker::setVisible(bool visible) | ||||
{ | ||||
|
r2174 | d_ptr->m_item->setVisible(visible); | ||
|
r2160 | } | ||
|
r2163 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
r2171 | QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) : | ||
q_ptr(q), | ||||
m_legend(legend) | ||||
|
r2167 | { | ||
m_item = new LegendMarkerItem(this); | ||||
|
r2182 | // m_item->setVisible(q->series()->isVisible()); | ||
|
r2167 | } | ||
|
r2163 | |||
|
r2166 | QLegendMarkerPrivate::~QLegendMarkerPrivate() | ||
{ | ||||
} | ||||
|
r2167 | |||
|
r2160 | #include "moc_qlegendmarker.cpp" | ||
|
r2163 | #include "moc_qlegendmarker_p.cpp" | ||
|
r2160 | |||
QTCOMMERCIALCHART_END_NAMESPACE | ||||