[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Mon Jun 18 16:01:35 CEST 2007
SVN commit 677121 by treat:
* Clean up plotitem to use proper ::paint overload
and remove extra spaces
M +7 -11 plotitem.cpp
M +4 -5 plotitem.h
M +2 -2 viewitem.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #677120:677121
@@ -29,12 +29,12 @@
// FIXME: temporary test code
QColor temp = Qt::black;
_colorStack.push(temp);
-
+
// FIXME: fake data for testing rendering
KstVectorPtr xTest = new KstSVector(0.0, 100.0, 10000, KstObjectTag::fromString("X vector"));
KstVectorPtr yTest = new KstSVector(-100.0, 100.0, 10000, KstObjectTag::fromString("Y vector"));
KstVCurvePtr renderTest = new KstVCurve(QString("rendertest"), xTest, yTest, NULL, NULL, NULL, NULL, QColor(Qt::red));
-
+
Render2DCartesian carTest(QString("cartesiantest"));
carTest.sources.append(kst_cast<KstBaseCurve>(renderTest));
renderers.append(carTest);
@@ -52,18 +52,17 @@
CreateCommand::createItem();
}
-void PlotItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+
+void PlotItem::paint(QPainter *painter) {
+ ViewItem::paint(painter);
+
QPainterPath path;
setBrush(Qt::transparent);
//FIXME: temporary test code
const qreal w = pen().widthF();
path.addEllipse(rect().adjusted(w, w, -w, -w));
painter->drawPath(path);
- QPen p = pen();
- setPen(Qt::NoPen);
- ViewItem::paint(painter, option, widget);
- setPen(p);
-
+
//QFont testFont;
//QColor fg = Qt::black;
//QPen testPen(fg);
@@ -75,11 +74,8 @@
*/
}
-void PlotItem::paint(QPainter *painter) {
}
-}
-
#include "plotitem.moc"
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #677120:677121
@@ -29,18 +29,17 @@
public:
PlotItem(View *parent);
virtual ~PlotItem();
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
void paint(QPainter *painter);
-
+
// List of renderers to use
QList<PlotRenderer2D> renderers;
-
+
private:
-
+
// Options common to the plot and all rendered data
QColor _backgroundColor;
QStack<QColor> _colorStack;
-
+
};
class KST_EXPORT CreatePlotCommand : public CreateCommand
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #677120:677121
@@ -279,6 +279,8 @@
Q_UNUSED(option);
Q_UNUSED(widget);
+ painter->setPen(pen());
+ painter->setBrush(brush());
paint(painter); //this is the overload that subclasses should use...
// QGraphicsRectItem::paint(painter, option, widget);
@@ -286,8 +288,6 @@
void ViewItem::paint(QPainter *painter) {
- painter->setPen(pen());
- painter->setBrush(brush());
painter->drawRect(rect());
}
More information about the Kst
mailing list