##// END OF EJS Templates
minor. Removes debug log
minor. Removes debug log

File last commit:

r625:d16a64d75da0
r625:d16a64d75da0
Show More
legendmarker.cpp
150 lines | 3.5 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"
sauimone
removed handlethemechange for legend. Too complex solution. Legend now listens the changed signals from series
r587 #include <qpieslice.h>
#include <qbarset.h>
sauimone
legend layouting change
r616 #include <qxyseries.h>
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 #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)
sauimone
fixed bug in legend name drawing
r585 ,mMarkerBoundingRect(0,0,1,1)
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)
sauimone
fixed bug in legend name drawing
r585 ,mTextItem(new QGraphicsSimpleTextItem(this))
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 {
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)
sauimone
fixed bug in legend name drawing
r585 ,mMarkerBoundingRect(0,0,1,1)
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)
sauimone
fixed bug in legend name drawing
r585 ,mTextItem(new QGraphicsSimpleTextItem(this))
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 {
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
fixed bug in legend name drawing
r585 ,mMarkerBoundingRect(0,0,1,1)
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
fixed bug in legend name drawing
r585 ,mTextItem(new QGraphicsSimpleTextItem(this))
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;
sauimone
fixed bug in legend name drawing
r585 // Calculate Marker pos
// TODO: remove hard coding. 5 is marigin around marker
QSizeF markerSize(10,10);
qreal x = mBoundingRect.x() + 5;
qreal y = mBoundingRect.y() + (mBoundingRect.height() - markerSize.height())/2;
mMarkerBoundingRect = QRectF(x,y,markerSize.width(),markerSize.height());
mTextItem.setPos(mBoundingRect.x() + markerSize.width() + 10, y );
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 }
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)
{
sauimone
fixed bug in legend name drawing
r585 mTextItem.setText(name);
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 }
QString LegendMarker::name() const
{
sauimone
fixed bug in legend name drawing
r585 return mTextItem.text();
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 }
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)
{
Tero Ahola
Squashed bunch of warnings
r611 Q_UNUSED(option)
Q_UNUSED(widget)
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 painter->setBrush(mBrush);
sauimone
fixed bug in legend name drawing
r585 painter->drawRect(mMarkerBoundingRect);
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 }
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 }
sauimone
removed handlethemechange for legend. Too complex solution. Legend now listens the changed signals from series
r587 void LegendMarker::changed()
{
switch (mType)
{
case LegendMarkerTypeSeries: {
sauimone
legend layouting change
r616 QXYSeries* s = static_cast<QXYSeries*> (mSeries);
setBrush(s->brush());
setName(s->name());
sauimone
removed handlethemechange for legend. Too complex solution. Legend now listens the changed signals from series
r587 break;
}
case LegendMarkerTypeBarset: {
setBrush(mBarset->brush());
setName(mBarset->name());
break;
}
case LegendMarkerTypePieslice: {
setBrush(mPieslice->sliceBrush());
setName(mPieslice->label());
break;
}
}
}
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 #include "moc_legendmarker_p.cpp"
QTCOMMERCIALCHART_END_NAMESPACE