Changed: #1302 Added the turn undo command.

This commit is contained in:
dnk-88 2011-08-11 22:58:45 +03:00
parent bf08374d32
commit 1472184783
9 changed files with 213 additions and 117 deletions

View file

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WorldEditorSettingsPage</class>
<widget class="QWidget" name="WorldEditorSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Colors</string>
</property>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="world_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -52,13 +52,14 @@ void addNewGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode
{
NLLIGO::IPrimitive *primitive = node->primitive();
NLLIGO::CPrimVector *vec = 0;
QGraphicsItem *item;
AbstractWorldItem *item = 0;
switch (node->primitiveClass()->Type)
{
case NLLIGO::CPrimitiveClass::Point:
{
vec = primitive->getPrimVector();
item = scene->addWorldItemPoint(QPointF(vec->x, -vec->y + cellSize), 0);
NLLIGO::CPrimPoint *primPoint = static_cast<NLLIGO::CPrimPoint *>(primitive);
item = scene->addWorldItemPoint(QPointF(vec->x, -vec->y + cellSize), primPoint->Angle);
break;
}
case NLLIGO::CPrimitiveClass::Path:
@ -91,12 +92,44 @@ void addNewGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode
break;
}
}
if (item != 0)
{
// Get color from world_editor_classes.xml
NLMISC::CRGBA color = Utils::ligoConfig()->getPrimitiveColor(*primitive);
/*
// Configurations (from world_editor_primitive_configuration.xml)
const std::vector<NLLIGO::CPrimitiveConfigurations> &configurations = Utils::ligoConfig()->getPrimitiveConfiguration();
// Look for the configuration
sint search = 0;
bool colorFound = false;
while ((search = theApp.getActiveConfiguration (*primitive, search)) != -1)
{
// Configuration activated ?
if (theApp.Configurations[search].Activated)
{
colorFound = true;
mainColor = configurations[search].Color;
break;
}
search++;
}
// try to get the primitive color ?
//if (!colorFound)*/
primitive->getPropertyByName ("Color", color);
item->setColor(QColor(color.R, color.G, color.B));
}
QVariant variantNode;
variantNode.setValue<Node *>(node);
item->setData(Constants::WORLD_EDITOR_NODE, variantNode);
QVariant graphicsData;
graphicsData.setValue<QGraphicsItem *>(item);
graphicsData.setValue<AbstractWorldItem *>(item);
node->setData(Constants::GRAPHICS_DATA_QT4_2D, graphicsData);
}
@ -119,7 +152,7 @@ void removeGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode
case NLLIGO::CPrimitiveClass::Path:
case NLLIGO::CPrimitiveClass::Zone:
{
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
QGraphicsItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
if (item != 0)
scene->removeWorldItem(item);
break;
@ -363,8 +396,8 @@ void MoveWorldItemsCommand::undo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->moveOn(-m_offset);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->moveOn(-m_offset);
}
}
@ -375,14 +408,14 @@ void MoveWorldItemsCommand::redo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->moveOn(m_offset);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->moveOn(m_offset);
}
}
m_firstRun = false;
}
RotateWorldItemsCommand::RotateWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal &angle,
RotateWorldItemsCommand::RotateWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal angle,
const QPointF &pivot, PrimitivesTreeModel *model, QUndoCommand *parent)
: QUndoCommand(parent),
m_listPaths(graphicsItemsToPaths(items, model)),
@ -391,7 +424,7 @@ RotateWorldItemsCommand::RotateWorldItemsCommand(const QList<QGraphicsItem *> &i
m_model(model),
m_firstRun(true)
{
setText("Rotate item(s)");
setText(QString("Rotate item(s) %1").arg(m_angle));
}
RotateWorldItemsCommand::~RotateWorldItemsCommand()
@ -403,8 +436,8 @@ void RotateWorldItemsCommand::undo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->rotateOn(m_pivot, -m_angle);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->rotateOn(m_pivot, -m_angle);
}
}
@ -415,8 +448,8 @@ void RotateWorldItemsCommand::redo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->rotateOn(m_pivot, m_angle);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->rotateOn(m_pivot, m_angle);
}
}
m_firstRun = false;
@ -444,8 +477,8 @@ void ScaleWorldItemsCommand::undo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->scaleOn(m_pivot, m_invertFactor);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->scaleOn(m_pivot, m_invertFactor);
}
}
@ -456,8 +489,47 @@ void ScaleWorldItemsCommand::redo()
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
qgraphicsitem_cast<AbstractWorldItem *>(item)->scaleOn(m_pivot, m_factor);
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->scaleOn(m_pivot, m_factor);
}
}
m_firstRun = false;
}
TurnWorldItemsCommand::TurnWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal angle,
PrimitivesTreeModel *model, QUndoCommand *parent)
: QUndoCommand(parent),
m_listPaths(graphicsItemsToPaths(items, model)),
m_angle(angle),
m_model(model),
m_firstRun(true)
{
setText(QString("Turn item(s) %1").arg(m_angle));
}
TurnWorldItemsCommand::~TurnWorldItemsCommand()
{
}
void TurnWorldItemsCommand::undo()
{
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->turnOn(-m_angle);
}
}
void TurnWorldItemsCommand::redo()
{
if (!m_firstRun)
{
for (int i = 0; i < m_listPaths.count(); ++i)
{
Node *node = m_model->pathToNode(m_listPaths.at(i));
AbstractWorldItem *item = qvariant_cast<AbstractWorldItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
item->turnOn(m_angle);
}
}
m_firstRun = false;

View file

@ -172,7 +172,7 @@ private:
class RotateWorldItemsCommand: public QUndoCommand
{
public:
RotateWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal &angle,
RotateWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal angle,
const QPointF &pivot, PrimitivesTreeModel *model, QUndoCommand *parent = 0);
virtual ~RotateWorldItemsCommand();
@ -210,6 +210,29 @@ private:
bool m_firstRun;
};
/**
@class TurnWorldItemsCommand
@brief
@details
*/
class TurnWorldItemsCommand: public QUndoCommand
{
public:
TurnWorldItemsCommand(const QList<QGraphicsItem *> &items, const qreal angle,
PrimitivesTreeModel *model, QUndoCommand *parent = 0);
virtual ~TurnWorldItemsCommand();
virtual void undo();
virtual void redo();
private:
const QList<Path> m_listPaths;
const qreal m_angle;
PrimitivesTreeModel *const m_model;
bool m_firstRun;
};
} /* namespace WorldEditor */
#endif // WORLD_EDITOR_ACTIONS_H

View file

@ -77,8 +77,8 @@ bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage
// Reset
m_ligoConfig.resetPrimitiveConfiguration ();
// Load
m_ligoConfig.readPrimitiveClass ("world_editor_primitive_configuration.xml", true);
// TODO: get file names! from settings
m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true);
addAutoReleasedObject(new WorldEditorContext(this));

View file

@ -59,21 +59,21 @@ WorldEditorScene::~WorldEditorScene()
{
}
QGraphicsItem *WorldEditorScene::addWorldItemPoint(const QPointF &point, const float angle)
AbstractWorldItem *WorldEditorScene::addWorldItemPoint(const QPointF &point, const float angle)
{
WorldItemPoint *item = new WorldItemPoint(point, angle);
addItem(item);
return item;
}
QGraphicsItem *WorldEditorScene::addWorldItemPath(const QPolygonF &polyline)
AbstractWorldItem *WorldEditorScene::addWorldItemPath(const QPolygonF &polyline)
{
WorldItemPath *item = new WorldItemPath(polyline);
addItem(item);
return item;
}
QGraphicsItem *WorldEditorScene::addWorldItemZone(const QPolygonF &polygon)
AbstractWorldItem *WorldEditorScene::addWorldItemZone(const QPolygonF &polygon)
{
WorldItemZone *item = new WorldItemZone(polygon);
addItem(item);
@ -167,11 +167,16 @@ void WorldEditorScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
break;
}
case WorldEditorScene::RotateMode:
m_angle = 0;
m_pivot = calcBoundingRect(m_selectedItems).center();
break;
case WorldEditorScene::ScaleMode:
m_scaleFactor = QPointF(1.0, 1.0);
m_pivot = calcBoundingRect(m_selectedItems).center();
break;
case WorldEditorScene::TurnMode:
m_angle = 0;
m_pivot = calcBoundingRect(m_selectedItems).center();
break;
case WorldEditorScene::RadiusMode:
break;
@ -204,24 +209,21 @@ void WorldEditorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
}
case WorldEditorScene::RotateMode:
{
QPointF pivot = calcBoundingRect(m_selectedItems).center();
// Caluculate angle between two line
QLineF firstLine(pivot, mouseEvent->lastScenePos());
QLineF secondLine(pivot, mouseEvent->scenePos());
QLineF firstLine(m_pivot, mouseEvent->lastScenePos());
QLineF secondLine(m_pivot, mouseEvent->scenePos());
qreal angle = secondLine.angleTo(firstLine);
m_angle += angle;
Q_FOREACH(QGraphicsItem *item, m_selectedItems)
{
qgraphicsitem_cast<AbstractWorldItem *>(item)->rotateOn(pivot, angle);
qgraphicsitem_cast<AbstractWorldItem *>(item)->rotateOn(m_pivot, angle);
}
break;
}
case WorldEditorScene::ScaleMode:
{
// TODO: perfomance
QPointF pivot = calcBoundingRect(m_selectedItems).center();
// Calculate scale factor
if (offset.x() > 0)
offset.setX(1.0 + (offset.x() / 5000));
@ -238,12 +240,26 @@ void WorldEditorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
Q_FOREACH(QGraphicsItem *item, m_selectedItems)
{
qgraphicsitem_cast<AbstractWorldItem *>(item)->scaleOn(pivot, offset);
qgraphicsitem_cast<AbstractWorldItem *>(item)->scaleOn(m_pivot, offset);
}
break;
}
case WorldEditorScene::TurnMode:
{
// Caluculate angle between two line
QLineF firstLine(m_pivot, mouseEvent->lastScenePos());
QLineF secondLine(m_pivot, mouseEvent->scenePos());
qreal angle = secondLine.angleTo(firstLine);
m_angle += angle;
Q_FOREACH(QGraphicsItem *item, m_selectedItems)
{
qgraphicsitem_cast<AbstractWorldItem *>(item)->turnOn(angle);
}
break;
}
case WorldEditorScene::RadiusMode:
break;
};
@ -276,30 +292,17 @@ void WorldEditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
case WorldEditorScene::MoveMode:
{
QPointF offset = mouseEvent->scenePos() - m_firstPick;
m_undoStack->push(new MoveWorldItemsCommand(m_selectedItems, offset, m_model));
break;
}
case WorldEditorScene::RotateMode:
{
QPointF pivot = calcBoundingRect(m_selectedItems).center();
// Caluculate angle between two line
QLineF firstLine(pivot, m_firstPick);
QLineF secondLine(pivot, mouseEvent->scenePos());
qreal angle = secondLine.angleTo(firstLine);
m_undoStack->push(new RotateWorldItemsCommand(m_selectedItems, angle, pivot, m_model));
m_undoStack->push(new RotateWorldItemsCommand(m_selectedItems, m_angle, m_pivot, m_model));
break;
}
case WorldEditorScene::ScaleMode:
{
QPointF pivot = calcBoundingRect(m_selectedItems).center();
m_undoStack->push(new ScaleWorldItemsCommand(m_selectedItems, m_scaleFactor, pivot, m_model));
m_undoStack->push(new ScaleWorldItemsCommand(m_selectedItems, m_scaleFactor, m_pivot, m_model));
break;
}
case WorldEditorScene::TurnMode:
m_undoStack->push(new TurnWorldItemsCommand(m_selectedItems, m_angle, m_model));
break;
case WorldEditorScene::RadiusMode:
break;

View file

@ -30,6 +30,7 @@
namespace WorldEditor
{
class PrimitivesTreeModel;
class AbstractWorldItem;
/*
@class WorldEditorScene
@ -55,9 +56,9 @@ public:
QUndoStack *undoStack, QObject *parent = 0);
virtual ~WorldEditorScene();
QGraphicsItem *addWorldItemPoint(const QPointF &point, const float angle);
QGraphicsItem *addWorldItemPath(const QPolygonF &polyline);
QGraphicsItem *addWorldItemZone(const QPolygonF &polygon);
AbstractWorldItem *addWorldItemPoint(const QPointF &point, const float angle);
AbstractWorldItem *addWorldItemPath(const QPolygonF &polyline);
AbstractWorldItem *addWorldItemZone(const QPolygonF &polygon);
void removeWorldItem(QGraphicsItem *item);
@ -87,9 +88,9 @@ private:
QPen m_pen1, m_pen2;
QBrush m_brush1, m_brush2;
QPointF m_firstPick, m_scaleFactor;
QPointF m_firstPick, m_scaleFactor, m_pivot;
QRectF m_selectionArea;
qreal m_firstPickX, m_firstPickY;
qreal m_firstPickX, m_firstPickY, m_angle;
QList<QGraphicsItem *> m_selectedItems;
bool m_editedSelectedItems, m_firstSelection;
uint m_lastPickedPrimitive;

View file

@ -322,9 +322,9 @@ int AbstractWorldItem::type() const
return Type;
}
WorldItemPoint::WorldItemPoint(const QPointF &point, const float angle, QGraphicsItem *parent)
WorldItemPoint::WorldItemPoint(const QPointF &point, const qreal angle, QGraphicsItem *parent)
: AbstractWorldItem(parent),
m_angle(angle)
m_angle((2 * NLMISC::Pi - angle) * 180 / NLMISC::Pi)
{
setZValue(WORLD_POINT_LAYER);
@ -343,7 +343,7 @@ WorldItemPoint::WorldItemPoint(const QPointF &point, const float angle, QGraphic
m_brush.setColor(QColor(255, 100, 10));
m_brush.setStyle(Qt::SolidPattern);
m_selectedBrush.setColor(QColor(0, 255, 0));
m_selectedBrush.setColor(Qt::NoPen);
m_selectedBrush.setStyle(Qt::SolidPattern);
//setFlag(ItemIsSelectable);
@ -396,14 +396,21 @@ void WorldItemPoint::scaleOn(const QPointF &pivot, const QPointF &factor)
setPos(scaledPolygon.boundingRect().center());
}
void WorldItemPoint::turnOn(const QPointF &offset)
void WorldItemPoint::turnOn(const qreal angle)
{
m_angle += angle;
update();
}
void WorldItemPoint::radiusOn(const qreal radius)
{
}
void WorldItemPoint::setColor(const QColor &color)
{
m_brush.setColor(color);
}
QPainterPath WorldItemPoint::shape() const
{
QPainterPath path;
@ -435,6 +442,14 @@ void WorldItemPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
}
painter->drawRect(m_rect);
painter->setPen(Qt::red);
painter->rotate(m_angle);
painter->drawLine(0, 0, SIZE_ARROW, 0);
painter->drawLine(SIZE_ARROW - 2, -2, SIZE_ARROW, 0);
painter->drawLine(SIZE_ARROW - 2, 2, SIZE_ARROW, 0);
}
QVariant WorldItemPoint::itemChange(GraphicsItemChange change, const QVariant &value)
@ -453,10 +468,10 @@ WorldItemPath::WorldItemPath(const QPolygonF &polygon, QGraphicsItem *parent)
setZValue(WORLD_PATH_LAYER);
m_pen.setColor(QColor(0, 0, 0));
m_pen.setColor(Qt::black);
m_pen.setWidth(5);
m_selectedPen.setColor(QColor(255, 0, 0));
m_selectedPen.setColor(Qt::white);
m_selectedPen.setWidth(5);
}
@ -499,7 +514,7 @@ void WorldItemPath::scaleOn(const QPointF &pivot, const QPointF &factor)
m_polygon.translate(pivot);
}
void WorldItemPath::turnOn(const QPointF &offset)
void WorldItemPath::turnOn(const qreal angle)
{
}
@ -507,6 +522,11 @@ void WorldItemPath::radiusOn(const qreal radius)
{
}
void WorldItemPath::setColor(const QColor &color)
{
m_pen.setColor(color);
}
QPainterPath WorldItemPath::shape() const
{
QPainterPath path;
@ -555,13 +575,13 @@ WorldItemZone::WorldItemZone(const QPolygonF &polygon, QGraphicsItem *parent)
m_pen.setColor(QColor(20, 100, 255));
m_pen.setWidth(0);
m_selectedPen.setColor(QColor(255, 0, 0));
m_selectedPen.setColor(Qt::white);
m_selectedPen.setWidth(0);
m_brush.setColor(QColor(20, 100, 255, 28));
m_brush.setColor(QColor(20, 100, 255, TRANSPARENCY));
m_brush.setStyle(Qt::SolidPattern);
m_selectedBrush.setColor(QColor(255, 0, 0, 128));
m_selectedBrush.setColor(QColor(255, 255, 255, 100));
m_selectedBrush.setStyle(Qt::SolidPattern);
}
@ -604,7 +624,7 @@ void WorldItemZone::scaleOn(const QPointF &pivot, const QPointF &factor)
m_polygon.translate(pivot);
}
void WorldItemZone::turnOn(const QPointF &offset)
void WorldItemZone::turnOn(const qreal angle)
{
}
@ -612,6 +632,16 @@ void WorldItemZone::radiusOn(const qreal radius)
{
}
void WorldItemZone::setColor(const QColor &color)
{
m_pen.setColor(color);
QColor brushColor(color);
brushColor.setAlpha(TRANSPARENCY);
m_brush.setColor(brushColor);
}
QRectF WorldItemZone::boundingRect() const
{
return m_polygon.boundingRect();

View file

@ -45,6 +45,7 @@ const int WORLD_PATH_LAYER = 200;
const int MIDDLE_POINT_LAYER = 201;
const int EDGE_POINT_LAYER = 201;
const int SIZE_ARROW = 20;
/*
// Deprecated
class GraphicsItemNode: public QGraphicsObject
@ -132,9 +133,11 @@ public:
virtual void rotateOn(const QPointF &pivot, const qreal deltaAngle) = 0;
// TODO: add modes: IgnoreAspectRatio, KeepAspectRatio
virtual void scaleOn(const QPointF &pivot, const QPointF &factor) = 0;
virtual void turnOn(const QPointF &offset) = 0;
virtual void turnOn(const qreal angle) = 0;
virtual void radiusOn(const qreal radius) = 0;
virtual void setColor(const QColor &color) = 0;
// Enable the use of qgraphicsitem_cast with this item.
int type() const;
};
@ -147,15 +150,17 @@ public:
class WorldItemPoint: public AbstractWorldItem
{
public:
WorldItemPoint(const QPointF &point, const float angle, QGraphicsItem *parent = 0);
WorldItemPoint(const QPointF &point, const qreal angle, QGraphicsItem *parent = 0);
virtual ~WorldItemPoint();
virtual void moveOn(const QPointF &offset);
virtual void rotateOn(const QPointF &pivot, const qreal deltaAngle);
virtual void scaleOn(const QPointF &pivot, const QPointF &factor);
virtual void turnOn(const QPointF &offset);
virtual void turnOn(const qreal angle);
virtual void radiusOn(const qreal radius);
virtual void setColor(const QColor &color);
virtual QRectF boundingRect() const;
virtual QPainterPath shape() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@ -166,13 +171,13 @@ protected:
private:
// TODO
static const int SIZE_POINT = 7;
static const int SIZE_POINT = 4;
QPen m_pen, m_selectedPen;
QBrush m_brush, m_selectedBrush;
QRectF m_rect;
float m_angle;
qreal m_angle;
};
/*
@ -189,9 +194,11 @@ public:
virtual void moveOn(const QPointF &offset);
virtual void rotateOn(const QPointF &pivot, const qreal deltaAngle);
virtual void scaleOn(const QPointF &pivot, const QPointF &factor);
virtual void turnOn(const QPointF &offset);
virtual void turnOn(const qreal angle);
virtual void radiusOn(const qreal radius);
virtual void setColor(const QColor &color);
virtual QRectF boundingRect() const;
virtual QPainterPath shape() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@ -217,9 +224,11 @@ public:
virtual void moveOn(const QPointF &offset);
virtual void rotateOn(const QPointF &pivot, const qreal deltaAngle);
virtual void scaleOn(const QPointF &pivot, const QPointF &factor);
virtual void turnOn(const QPointF &offset);
virtual void turnOn(const qreal angle);
virtual void radiusOn(const qreal radius);
virtual void setColor(const QColor &color);
virtual QRectF boundingRect() const;
virtual QPainterPath shape() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@ -227,6 +236,8 @@ public:
protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
static const int TRANSPARENCY = 28;
QPen m_pen, m_selectedPen;
QBrush m_brush, m_selectedBrush;
QPolygonF m_polygon;

View file

@ -293,7 +293,7 @@
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="world_editor.qrc">