[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Thu Jun 7 16:30:33 CEST 2007
SVN commit 672559 by treat:
* Convert items to common qgv base class
M +10 -0 ellipseitem.cpp
M +3 -2 ellipseitem.h
M +4 -3 pictureitem.cpp
M +3 -3 svgitem.cpp
M +0 -1 viewcommand.h
--- branches/work/kst/portto4/kst/src/libkstapp/ellipseitem.cpp #672558:672559
@@ -27,6 +27,16 @@
}
+void EllipseItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+ const qreal w = pen().widthF();
+ painter->drawEllipse(rect().adjusted(w, w, -w, -w));
+ QPen p = pen();
+ setPen(Qt::NoPen);
+ QGraphicsRectItem::paint(painter, option, widget);
+ setPen(p);
+}
+
+
void EllipseItem::creationPolygonChanged(View::CreationEvent event) {
if (event == View::MousePress) {
const QPolygonF poly = mapFromScene(parentView()->creationPolygon(View::MousePress));
--- branches/work/kst/portto4/kst/src/libkstapp/ellipseitem.h #672558:672559
@@ -13,11 +13,11 @@
#define ELLIPSEITEM_H
#include "viewitem.h"
-#include <QGraphicsEllipseItem>
+#include <QGraphicsRectItem>
namespace Kst {
-class EllipseItem : public ViewItem, public QGraphicsEllipseItem
+class EllipseItem : public ViewItem, public QGraphicsRectItem
{
Q_OBJECT
public:
@@ -25,6 +25,7 @@
virtual ~EllipseItem();
virtual QGraphicsItem *graphicsItem() { return this; }
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
private Q_SLOTS:
void creationPolygonChanged(View::CreationEvent event);
--- branches/work/kst/portto4/kst/src/libkstapp/pictureitem.cpp #672558:672559
@@ -34,10 +34,11 @@
const qreal w = pen().widthF();
painter->drawPixmap(rect().adjusted(w, w, -w, -w), _image, _image.rect());
}
- QBrush b = brush();
- setBrush(Qt::NoBrush);
+
+ QPen p = pen();
+ setPen(Qt::NoPen);
QGraphicsRectItem::paint(painter, option, widget);
- setBrush(b);
+ setPen(p);
}
--- branches/work/kst/portto4/kst/src/libkstapp/svgitem.cpp #672558:672559
@@ -36,10 +36,10 @@
_svg->render(painter, boundingRect());
}
- QBrush b = brush();
- setBrush(Qt::NoBrush);
+ QPen p = pen();
+ setPen(Qt::NoPen);
QGraphicsRectItem::paint(painter, option, widget);
- setBrush(b);
+ setPen(p);
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewcommand.h #672558:672559
@@ -16,7 +16,6 @@
#include <QUndoCommand>
#include "kst_export.h"
-
namespace Kst {
class View;
More information about the Kst
mailing list