##// END OF EJS Templates
Drop shadow in scatter
Tero Ahola -
r346:d59509c2ed03
parent child
Show More
@@ -4,6 +4,7
4 4 #include <QPainter>
5 5 #include <QGraphicsScene>
6 6 #include <QGraphicsSceneMouseEvent>
7 #include <QGraphicsDropShadowEffect>
7 8 #include <QDebug>
8 9 #include <QTime>
9 10
@@ -13,8 +14,6 ScatterPresenter::ScatterPresenter(QScatterSeries *series, QGraphicsObject *pare
13 14 ChartItem(parent),
14 15 m_series(series),
15 16 m_boundingRect(),
16 //m_markerColor(QColor()),
17 // m_markerColor(QColor(255, 0, 0)),
18 17 m_visibleChartArea()
19 18 {
20 19 if (parent)
@@ -23,6 +22,10 ScatterPresenter::ScatterPresenter(QScatterSeries *series, QGraphicsObject *pare
23 22 if (series) {
24 23 connect(series, SIGNAL(changed()), this, SLOT(handleModelChanged()));
25 24 }
25
26 QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
27 dropShadow->setOffset(2.0);
28 setGraphicsEffect(dropShadow);
26 29 }
27 30
28 31 void ScatterPresenter::handleDomainChanged(const Domain& domain)
@@ -60,14 +63,6 void ScatterPresenter::paint(QPainter *painter, const QStyleOptionGraphicsItem *
60 63 painter->setPen(pen);
61 64 painter->drawPath(m_path);
62 65
63 // TODO: how to draw a drop shadow?
64 QPen dropShadowPen(QColor(0, 0, 0, 70));
65 dropShadowPen.setWidth(3);
66 painter->setPen(dropShadowPen);
67 painter->setBrush(Qt::NoBrush);
68 painter->setRenderHint(QPainter::Antialiasing);
69 painter->drawPath(m_path.translated(2, 2));
70
71 66 painter->restore();
72 67 }
73 68
General Comments 0
You need to be logged in to leave comments. Login now