30 #include "../../../../core/pattern/mvc/ItemObserver.h"
31 #include "../../../../core/pattern/mvc/Observable.h"
32 #include "../../../../core/pattern/mvc/ItemModelObservable.h"
33 #include "../../../outside/PropertiesOutside.h"
34 #include "../../../../core/property/Properties.h"
37 #include <QGraphicsItem>
44 m_oldProperties(oldProperties),
45 m_newProperties(newProperties),
52 std::vector<Properties*> allNew,
PropertiesOutside* outside , QUndoCommand *parent ) :
59 m_allOldProperties(allOld),
60 m_allNewProperties(allNew)
69 delete m_oldProperties;
75 delete m_newProperties;
79 if(!m_allOldProperties.empty())
81 std::vector<Properties*>::iterator ito;
82 for(ito = m_allOldProperties.begin() ; ito != m_allOldProperties.end() ; ++ito)
94 m_allOldProperties.
clear();
97 if(!m_allNewProperties.empty())
99 std::vector<Properties*>::iterator itn;
100 for(itn = m_allNewProperties.begin() ; itn != m_allNewProperties.end() ; ++itn)
112 m_allNewProperties.
clear();
120 if(!checkItem(m_item, m_oldProperties))
131 for(
unsigned int i = 0 ; i < m_items.size() ; ++i)
133 QGraphicsItem* item = m_items[i];
137 checkItem(item, props);
143 m_outside->refreshOutside();
146 setText(QObject::tr(
"Change Properties %1")
147 .arg(createCommandString(m_item)));
154 if(!checkItem(m_item, m_newProperties))
165 for(
unsigned int i = 0 ; i < m_items.size() ; ++i)
167 QGraphicsItem* item = m_items[i];
171 checkItem(item, props);
177 m_outside->refreshOutside();
180 setText(QObject::tr(
"Change Properties %1")
181 .arg(createCommandString(m_item)));
190 return QObject::tr(
"%1 %2").arg(m_items.size()).arg(
"items");
192 return QObject::tr(
"%1");
198 return QObject::tr(
"%1");
200 QPointF pos = m_item->scenePos();
202 return QObject::tr(
"%1 at (%2, %3)")
204 .arg(pos.x()).arg(pos.y());
217 for(
unsigned int i = 0 ; i < props1->
getProperties().size() ; ++i)
222 if(proper1 == proper2)
254 if(equals(props, propsModel))
265 if(m_allNewProperties.size() != m_items.size() ||
266 m_allOldProperties.size() != m_items.size())
virtual bool checkVectors()
Variant getValue()
Returns stored value.
virtual void redo()
Reimplemented from QUndoCommand.
Properties tree for any item, MVC component, using Qt for presentation and editing.
std::string getName()
Returns name.
Abstract class to represent an observable. "Model" part of MVC component. All classes representing th...
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
virtual std::vector< Property > getProperties()
Returns set of all properties.
virtual void updateProperties(te::layout::Properties *properties)
Reimplemented from Observable.
virtual void redraw(bool bRefresh=true)
Redraws the graphic component.
virtual bool equals(Properties *props1, Properties *props2)
ChangePropertyCommand(QGraphicsItem *item, Properties *oldProperties, Properties *newProperties, PropertiesOutside *outside=0, QUndoCommand *parent=0)
Constructor.
virtual EnumType * getType()=0
Returns the type of component Reimplement this function in a Observable subclass to provide the model...
virtual ~ChangePropertyCommand()
Destructor. Delete all properties.
virtual bool checkItem(QGraphicsItem *item, Properties *props)
virtual Properties * getProperties() const
Reimplemented from Observable.
virtual void undo()
Reimplemented from QUndoCommand.
virtual Observable * getModel()
Returns the "Model" part of the MVC.
virtual bool clear()
Clear set of properties of this object.
virtual QString createCommandString(QGraphicsItem *item)
Undo/Redo for changes in component properties.
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value.