30 #include "../../core/pattern/singleton/Context.h"
31 #include "../../core/AbstractScene.h"
32 #include "../core/Scene.h"
33 #include "../../core/pattern/mvc/OutsideModelObservable.h"
34 #include "../../core/pattern/mvc/ItemObserver.h"
35 #include "../../core/pattern/mvc/OutsideObserver.h"
36 #include "../../core/pattern/mvc/OutsideController.h"
37 #include "../../../geometry/Envelope.h"
38 #include "../../core/enum/Enums.h"
39 #include "../core/propertybrowser/VariantPropertiesBrowser.h"
40 #include "../core/propertybrowser/DialogPropertiesBrowser.h"
41 #include "../item/MovingItemGroup.h"
44 #include <QGraphicsWidget>
45 #include <QVBoxLayout>
55 setWindowTitle(
"Object Inspector");
56 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
63 QVBoxLayout* layout =
new QVBoxLayout(
this);
67 QGroupBox* groupBox =
new QGroupBox;
68 groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
69 groupBox->setLayout(layout);
71 QVBoxLayout* layoutAll =
new QVBoxLayout(
this);
72 layoutAll->setMargin(0);
74 layoutAll->addWidget(groupBox);
88 setVisible(context.
isShow());
89 if(context.
isShow() ==
true)
103 QPointF posF = pos();
104 qreal valuex = posF.x();
105 qreal valuey = posF.y();
108 coordinate.
x = valuex;
109 coordinate.
y = valuey;
116 if(hasMoveItemGroup(graphicsItems))
121 m_layoutPropertyBrowser->clearAll();
123 m_graphicsItems = graphicsItems;
125 if(m_graphicsItems.empty())
130 foreach(QGraphicsItem *item, graphicsItems)
164 std::vector<std::string>::iterator it;
166 for(it = names.begin() ; it != names.end() ; ++it)
168 Property prop = m_layoutPropertyBrowser->getVariantPropertiesBrowser()->getProperty(*it);
172 prop = m_layoutPropertyBrowser->getDialogPropertiesBrowser()->getProperty(*it);
175 m_layoutPropertyBrowser->removeProperty(prop);
181 foreach(QGraphicsItem *item, graphicsItems)
199 return m_layoutPropertyBrowser;
213 foreach(QGraphicsItem *item, graphicsItems)
232 QtProperty* prop = 0;
245 Property pro_class = createProperty(lItem);
247 if(hasProperty(pro_class))
252 if(item->parentItem())
257 prop = m_layoutPropertyBrowser->addProperty(pro_class);
259 if(!item->childItems().isEmpty())
261 createSubProperty(item, prop);
274 foreach(QGraphicsItem *item, item->childItems())
287 Property pro_class = createProperty(lItem);
288 if(hasProperty(pro_class))
293 QtProperty* subProp = m_layoutPropertyBrowser->addProperty(pro_class);
299 m_layoutPropertyBrowser->addSubProperty(prop, subProp);
331 std::string name =
property.getName();
332 std::string label =
property.getLabel();
334 QtProperty* prop = m_layoutPropertyBrowser->findProperty(name);
337 prop = m_layoutPropertyBrowser->findProperty(label);
Abstract class to represent an observable. "Model" part of MVC component.
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Class to represent a graphic object (MVC component) and widget object (MVC widget) type enumeration...
virtual void itemsInspector(QList< QGraphicsItem * > graphicsItems)
virtual EnumDataType * getEnumDataType()
Returns data type enumeration.
Tree of names of all the items entered on the scene, MVC components, using Qt to present the name of ...
QtTreePropertyBrowser * getPropertyEditor()
bool isNull()
Returns true if no value has been set, false otherwise.
virtual EnumType * getPaperItem() const
Returns value that represents paper (MVC Component) type belonging to enumeration.
virtual te::gm::Envelope getBox()=0
Returns the bounding rectangle of the component in scene coordinates(millimeters). Starting point is llx, lly. Reimplement this function in a Observable subclass to provide the model's getBox implementation.
Abstract class to represent an observer. "View" part of MVC widget. All classes representing the grap...
virtual te::gm::Coord2D getPosition()
Method that returns the position llx, lly Reimplement this function in a ItemObserver subclass to pro...
double getWidth() const
It returns the envelope width.
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
An utility struct for representing 2D coordinates.
PropertyBrowser * m_layoutPropertyBrowser
virtual bool hasProperty(Property property)
virtual EnumObjectType * getEnumObjectType()
Returns graphic object (MVC component) and widget object (MVC widget) type enumeration.
virtual void onRemoveProperties(std::vector< std::string > names)
virtual void setPosition(const double &x, const double &y)
Change coordinate llx,lly of the MVC widget. Reimplement this function in a ItemController subclass t...
Manage properties variants values. Maps the QProperty properties (Qt) and Property (Layout) and add t...
virtual PropertyBrowser * getObjectInspector()
virtual bool hasMoveItemGroup(QList< QGraphicsItem * > graphicsItems)
virtual EnumType * getType()=0
Returns the type of component Reimplement this function in a Observable subclass to provide the model...
static Enums & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
ObjectInspectorOutside(OutsideController *controller, Observable *o, PropertyBrowser *propertyBrowser=0)
virtual std::string getNameClass()
Method that returns the class name.
Class to represent a data type enumeration. Ex.: int, double, bool, te::color::RGBAColor (color)...
virtual void createSubProperty(QGraphicsItem *item, QtProperty *prop)
virtual void updateObserver(ContextItem context)
Reimplemented from Observer.
virtual EnumType * getMovingItemGroup() const
Returns value that represents moving item group (MVC Component) type belonging to enumeration...
virtual void selectItems(QList< QGraphicsItem * > graphicsItems)
virtual Property createProperty(ItemObserver *item)
void setValue(ValueType value, EnumType *type)
Stores a copy of value.
Observable * m_model
"Model" part of MVC widget.
virtual Observable * getModel()
Returns the "Model" part of the MVC.
void setEditable(bool editable)
Sets true if property is editable, false otherwise.
virtual QtProperty * addProperty(QGraphicsItem *item)
void setName(std::string name)
Sets the name of this property.
Abstract class to represent a controller. "Controller" part of MVC widget. All classes representing t...
virtual EnumType * getDataTypeString() const
Returns value that represents type string belonging to enumeration.
virtual std::string getName()=0
Method that returns the name of the MVC component. Reimplement this function in a Observable subclass...
virtual ~ObjectInspectorOutside()
double getHeight() const
It returns the envelope height.
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.