##// END OF EJS Templates
Legend can handle removing of series
Legend can handle removing of series

File last commit:

r576:47e29632d9f9
r576:47e29632d9f9
Show More
legendmarker.cpp
109 lines | 2.3 KiB | text/x-c | CppLexer
/ src / legendmarker.cpp
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 #include "qchartglobal.h"
#include "legendmarker_p.h"
#include <QPainter>
#include <QGraphicsSceneEvent>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
LegendMarker::LegendMarker(QSeries* series, QGraphicsItem *parent)
: QGraphicsObject(parent)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 ,mBoundingRect(0,0,1,1)
,mName("")
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 ,mSeries(series)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 ,mBarset(0)
,mPieslice(0)
,mType(LegendMarkerTypeSeries)
{
setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
}
sauimone
Legend can handle removing of series
r576 LegendMarker::LegendMarker(QSeries *series, QBarSet *barset, QGraphicsItem *parent)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 : QGraphicsObject(parent)
,mBoundingRect(0,0,1,1)
,mName("")
sauimone
Legend can handle removing of series
r576 ,mSeries(series)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 ,mBarset(barset)
,mPieslice(0)
,mType(LegendMarkerTypeBarset)
{
setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
}
sauimone
Legend can handle removing of series
r576 LegendMarker::LegendMarker(QSeries *series, QPieSlice *pieslice, QGraphicsItem *parent)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 : QGraphicsObject(parent)
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 ,mBoundingRect(0,0,1,1)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 ,mName("")
sauimone
Legend can handle removing of series
r576 ,mSeries(series)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 ,mBarset(0)
,mPieslice(pieslice)
,mType(LegendMarkerTypePieslice)
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 {
setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
}
void LegendMarker::setBoundingRect(const QRectF rect)
{
mBoundingRect = rect;
}
void LegendMarker::setBrush(const QBrush brush)
{
mBrush = brush;
}
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 QBrush LegendMarker::brush() const
{
return mBrush;
}
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 void LegendMarker::setName(const QString name)
{
mName = name;
}
QString LegendMarker::name() const
{
return mName;
}
sauimone
Legend can handle removing of series
r576 QSeries* LegendMarker::series() const
{
return mSeries;
}
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 void LegendMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setBrush(mBrush);
painter->drawRect(mBoundingRect);
}
QRectF LegendMarker::boundingRect() const
{
return mBoundingRect;
}
void LegendMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 switch (mType)
{
case LegendMarkerTypeSeries: {
sauimone
combined clicked and rightclicked events of legend to one event with parameter
r567 emit clicked(mSeries,event->button());
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 break;
sauimone
bug fix in legend signals
r569 }
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 case LegendMarkerTypeBarset: {
sauimone
combined clicked and rightclicked events of legend to one event with parameter
r567 emit clicked(mBarset,event->button());
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 break;
sauimone
bug fix in legend signals
r569 }
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 case LegendMarkerTypePieslice: {
sauimone
combined clicked and rightclicked events of legend to one event with parameter
r567 emit clicked(mPieslice,event->button());
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 break;
}
default: {
break;
sauimone
bug fix in legend signals
r569 }
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 }
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 }
#include "moc_legendmarker_p.cpp"
QTCOMMERCIALCHART_END_NAMESPACE