[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Thu Sep 6 18:28:00 CEST 2007
SVN commit 709139 by treat:
* Start transition to ok,apply,cancel
M +1 -4 viewitem.cpp
M +14 -30 viewitemdialog.cpp
M +3 -4 viewitemdialog.h
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #709138:709139
@@ -372,10 +372,7 @@
void ViewItem::edit() {
-
- QList<QGraphicsItem*> list = scene()->selectedItems();
- if (!list.isEmpty())
- ViewItemDialog::self()->show(list);
+ ViewItemDialog::self()->show(this);
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #709138:709139
@@ -11,11 +11,11 @@
#include "viewitemdialog.h"
+#include "viewitem.h"
#include "fillandstroke.h"
#include <QPen>
#include <QBrush>
-#include <QAbstractGraphicsShapeItem>
#include <QDebug>
namespace Kst {
@@ -57,11 +57,9 @@
ViewItemDialog::~ViewItemDialog() {
}
-void ViewItemDialog::show(QList<QGraphicsItem*> items) {
- Q_ASSERT(!items.isEmpty());
+void ViewItemDialog::show(ViewItem *item) {
+ _item = item;
- _items = items;
-
setupFill();
setupStroke();
@@ -71,11 +69,9 @@
}
void ViewItemDialog::setupFill() {
- QAbstractGraphicsShapeItem *first = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(_items.first());
- Q_ASSERT(first);
+ Q_ASSERT(_item);
+ QBrush b = _item->brush();
- QBrush b = first->brush();
-
_fillAndStroke->setFillColor(b.color());
_fillAndStroke->setFillStyle(b.style());
@@ -89,10 +85,8 @@
void ViewItemDialog::setupStroke() {
- QAbstractGraphicsShapeItem *first = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(_items.first());
- Q_ASSERT(first);
-
- QPen p = first->pen();
+ Q_ASSERT(_item);
+ QPen p = _item->pen();
QBrush b = p.brush();
_fillAndStroke->setStrokeStyle(p.style());
@@ -107,11 +101,8 @@
void ViewItemDialog::fillChanged() {
- QAbstractGraphicsShapeItem *first = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(_items.first());
- Q_ASSERT(first);
+ QBrush b = _item->brush();
- QBrush b = first->brush();
-
b.setColor(_fillAndStroke->fillColor());
b.setStyle(_fillAndStroke->fillStyle());
@@ -122,18 +113,14 @@
b = QBrush(gradient);
#endif
- foreach(QGraphicsItem *item, _items) {
- QAbstractGraphicsShapeItem *shape = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(item);
- shape->setBrush(b);
- }
+ Q_ASSERT(_item);
+ _item->setBrush(b);
}
void ViewItemDialog::strokeChanged() {
- QAbstractGraphicsShapeItem *first = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(_items.first());
- Q_ASSERT(first);
-
- QPen p = first->pen();
+ Q_ASSERT(_item);
+ QPen p = _item->pen();
QBrush b = p.brush();
p.setStyle(_fillAndStroke->strokeStyle());
@@ -146,15 +133,12 @@
p.setCapStyle(_fillAndStroke->capStyle());
p.setBrush(b);
- foreach(QGraphicsItem *item, _items) {
- QAbstractGraphicsShapeItem *shape = qgraphicsitem_cast<QAbstractGraphicsShapeItem*>(item);
- shape->setPen(p);
- }
+ _item->setPen(p);
}
void ViewItemDialog::setVisible(bool visible) {
- if (visible && _items.isEmpty())
+ if (visible && !_item)
return; //nothing to show...
QDialog::setVisible(visible);
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.h #709138:709139
@@ -17,10 +17,9 @@
#include "kst_export.h"
-class QGraphicsItem;
-
namespace Kst {
+class ViewItem;
class FillAndStroke;
class KST_EXPORT ViewItemDialog : public QDialog
@@ -29,7 +28,7 @@
public:
static ViewItemDialog *self();
- void show(QList<QGraphicsItem*> items);
+ void show(ViewItem *item);
private:
ViewItemDialog(QWidget *parent = 0);
@@ -46,7 +45,7 @@
void setVisible(bool visible);
private:
- QList<QGraphicsItem*> _items;
+ QPointer<ViewItem> _item;
FillAndStroke *_fillAndStroke;
};
More information about the Kst
mailing list