##// END OF EJS Templates
drawing fix for bar chart
sauimone -
r83:1b872afb5c9f
parent child
Show More
@@ -42,6 +42,7 void Bar::setPos(qreal x, qreal y)
42 42 void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
43 43 {
44 44 if (0 == mHeight) {
45 // Nothing to draw
45 46 return;
46 47 }
47 48 // Set color for bar. TODO: gradients, textures etc
@@ -51,10 +52,8 void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidg
51 52 painter->setPen(pen);
52 53
53 54 // Draw bar
54 // TODO: Pen width affects bar height for now. This should be rect
55 // painter->drawRect(mXpos,mYpos,mWidth,mHeight);
56 painter->drawLine(mXpos, mYpos + mHeight - mWidth,
57 mXpos, mYpos + mWidth);
55 painter->drawLine(mXpos, mYpos ,
56 mXpos, mYpos - mHeight);
58 57 }
59 58
60 59 QRectF Bar::boundingRect() const
@@ -128,7 +128,8 void BarGroup::layoutChanged()
128 128 bar->setColor(mColors.at(series));
129 129
130 130 // TODO: bar width shouldn't affect height. Currently it does because pen width also affects height. (QPainter thingy...)
131 bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight - barHeight + mBarDefaultWidth);
131 // bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight - barHeight);
132 bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight);
132 133 itemIndex++;
133 134 }
134 135 }
General Comments 0
You need to be logged in to leave comments. Login now