##// END OF EJS Templates
fix to example. Event handling prototyping.
fix to example. Event handling prototyping.

File last commit:

r2169:04485231feed
r2169:04485231feed
Show More
qlegendmarker.cpp
192 lines | 3.9 KiB | text/x-c | CppLexer
/ src / legend / qlegendmarker.cpp
sauimone
first prototry of QLegendMarker API
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"
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 #include "qlegendmarker_p.h"
sauimone
added LegendMarkerItem. Updated new legend example to test clicked of LegendMarker
r2164 #include "legendmarkeritem_p.h"
sauimone
first prototry of QLegendMarker API
r2160 #include <QDebug>
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 #include <QFontMetrics>
sauimone
fix to example. Event handling prototyping.
r2169 #include <QGraphicsSceneEvent>
sauimone
first prototry of QLegendMarker API
r2160
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
refactoring
r2167 /*
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 QLegendMarker::QLegendMarker(QAbstractSeries* series, QObject *parent) :
QObject(parent),
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 d_ptr(new QLegendMarkerPrivate(series, this))
sauimone
first prototry of QLegendMarker API
r2160 {
}
sauimone
refactoring
r2167 */
QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) :
QObject(parent),
d_ptr(&d)
{
}
sauimone
first prototry of QLegendMarker API
r2160
QLegendMarker::~QLegendMarker()
{
}
QString QLegendMarker::label() const
{
sauimone
layout work started
r2168 return d_ptr->label();
sauimone
first prototry of QLegendMarker API
r2160 }
void QLegendMarker::setLabel(const QString &label)
{
sauimone
layout work started
r2168 d_ptr->setLabel(label);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
QBrush QLegendMarker::labelBrush() const
{
sauimone
layout work started
r2168 return d_ptr->labelBrush();
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
void QLegendMarker::setLabelBrush(const QBrush &brush)
{
sauimone
layout work started
r2168 d_ptr->setLabelBrush(brush);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
QFont QLegendMarker::font() const
{
sauimone
layout work started
r2168 return d_ptr->font();
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
void QLegendMarker::setFont(const QFont &font)
{
sauimone
layout work started
r2168 d_ptr->setFont(font);
sauimone
first prototry of QLegendMarker API
r2160 }
QPen QLegendMarker::pen() const
{
sauimone
layout work started
r2168 return d_ptr->pen();
sauimone
first prototry of QLegendMarker API
r2160 }
void QLegendMarker::setPen(const QPen &pen)
{
sauimone
layout work started
r2168 d_ptr->setPen(pen);
sauimone
first prototry of QLegendMarker API
r2160 }
QBrush QLegendMarker::brush() const
{
sauimone
layout work started
r2168 return d_ptr->brush();
sauimone
first prototry of QLegendMarker API
r2160 }
void QLegendMarker::setBrush(const QBrush &brush)
{
sauimone
layout work started
r2168 d_ptr->setBrush(brush);
sauimone
first prototry of QLegendMarker API
r2160 }
bool QLegendMarker::isVisible() const
{
sauimone
layout work started
r2168 return d_ptr->isVisible();
sauimone
first prototry of QLegendMarker API
r2160 }
void QLegendMarker::setVisible(bool visible)
{
sauimone
layout work started
r2168 d_ptr->setVisible(visible);
sauimone
first prototry of QLegendMarker API
r2160 }
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
refactoring
r2167 QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q) :
q_ptr(q)
{
sauimone
layout work started
r2168 // qDebug() << "QLegendMarkerPrivate created";
sauimone
refactoring
r2167 m_item = new LegendMarkerItem(this);
}
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163
sauimone
QPieLegenmarkerPrivate added
r2166 QLegendMarkerPrivate::~QLegendMarkerPrivate()
{
}
sauimone
refactoring
r2167 void QLegendMarkerPrivate::handleMousePressEvent(QGraphicsSceneEvent *event)
{
sauimone
fix to example. Event handling prototyping.
r2169 // Just emit clicked signal for now (our default logic for events)
// This could propably be on the LegendMarkerItem?
// TODO: how to handle scrolling vs clicking? drag event?
event->accept();
sauimone
refactoring
r2167 Q_Q(QLegendMarker);
emit q->clicked();
}
sauimone
layout work started
r2168 void QLegendMarkerPrivate::setPen(const QPen &pen)
{
m_item->setPen(pen);
}
QPen QLegendMarkerPrivate::pen() const
{
return m_item->pen();
}
void QLegendMarkerPrivate::setBrush(const QBrush &brush)
{
m_item->setBrush(brush);
}
QBrush QLegendMarkerPrivate::brush() const
{
return m_item->brush();
}
void QLegendMarkerPrivate::setFont(const QFont &font)
{
m_item->setFont(font);
}
QFont QLegendMarkerPrivate::font() const
{
return m_item->font();
}
void QLegendMarkerPrivate::setLabel(const QString label)
{
m_item->setLabel(label);
}
QString QLegendMarkerPrivate::label() const
{
return m_item->label();
}
void QLegendMarkerPrivate::setLabelBrush(const QBrush &brush)
{
m_item->setLabelBrush(brush);
}
QBrush QLegendMarkerPrivate::labelBrush() const
{
return m_item->labelBrush();
}
bool QLegendMarkerPrivate::isVisible() const
{
return m_item->isVisible();
}
void QLegendMarkerPrivate::setVisible(bool visible)
{
m_item->setVisible(visible);
}
sauimone
QPieLegenmarkerPrivate added
r2166
sauimone
first prototry of QLegendMarker API
r2160 #include "moc_qlegendmarker.cpp"
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 #include "moc_qlegendmarker_p.cpp"
sauimone
first prototry of QLegendMarker API
r2160
QTCOMMERCIALCHART_END_NAMESPACE