35 #include "../../../../geometry/Envelope.h"
46 #include <QGraphicsItem>
47 #include <QVBoxLayout>
48 #include <QHBoxLayout>
49 #include <QToolButton>
53 QDockWidget(
"", 0, 0),
55 m_updatingValues(false),
61 setWindowTitle(
"Layout - Propriedades");
62 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
64 setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
81 if(m_layoutPropertyBrowser)
83 delete m_layoutPropertyBrowser;
84 m_layoutPropertyBrowser = 0;
98 QVBoxLayout* layout =
new QVBoxLayout(
this);
101 QHBoxLayout* filterLayout =
new QHBoxLayout;
103 m_configurePropertyEditor =
new QToolButton(
this);
104 m_configurePropertyEditor->setText(tr(
"Config"));
105 m_configurePropertyEditor->setBaseSize(QSize(16,16));
107 m_propertyFilterEdit =
new QLineEdit(
this);
108 m_propertyFilterEdit->setToolTip(tr(
"String or regular expression to filter property list with"));
110 connect(m_propertyFilterEdit,SIGNAL(textChanged(QString)),
111 m_layoutPropertyBrowser,SLOT(onChangeFilter(QString)));
113 filterLayout->addWidget(m_propertyFilterEdit);
114 filterLayout->addWidget(m_configurePropertyEditor);
116 layout->addLayout(filterLayout);
117 m_nameLabel =
new QLabel(tr(
"QObject::unknown"),
this);
118 layout->addWidget(m_nameLabel);
119 layout->addWidget(m_layoutPropertyBrowser->getPropertyEditor());
121 QGroupBox* groupBox =
new QGroupBox;
122 groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
123 groupBox->setLayout(layout);
145 QPointF posF = pos();
146 qreal valuex = posF.x();
147 qreal valuey = posF.y();
150 coordinate.
x = valuex;
151 coordinate.
y = valuey;
158 m_updatingValues =
false;
160 m_layoutPropertyBrowser->clearAll();
162 m_graphicsItems = graphicsItems;
164 m_allItems = allItems;
166 if(m_graphicsItems.empty())
169 bool gridWindow =
false;
170 Properties* props = intersection(graphicsItems, gridWindow);
171 m_layoutPropertyBrowser->setHasGridWindows(gridWindow);
178 checkDynamicProperty(prop, allItems);
179 m_layoutPropertyBrowser->addProperty(prop);
190 foreach( QGraphicsItem *item, m_graphicsItems)
217 m_layoutPropertyBrowser->closeAllWindows();
224 if(graphicsItems.size() == 1)
226 QGraphicsItem* item = graphicsItems.first();
239 props = sameProperties(graphicsItems, gridWindow);
248 std::vector<Properties*> propsVec = getAllProperties(graphicsItems, gridWindow);
250 QGraphicsItem* firstItem = graphicsItems.first();
264 std::vector<Properties*>::iterator it = propsVec.begin();
265 std::vector<Properties*>::iterator itend = propsVec.end();
269 contains(itend, it, prop.
getName(), result);
284 std::vector<Properties*>::iterator it, std::string name,
bool& result )
286 Property prop = (*it)->contains(name);
298 contains(itend, it, name, result);
303 std::vector<te::layout::Properties*>
307 std::vector<Properties*> propsVec;
310 foreach( QGraphicsItem *item, graphicsItems)
320 propsVec.push_back(propsItem);
336 foreach(std::string str, list)
340 property.addOption(v);
346 if(property.
getName().compare(m_sharedProps->getMapName()) == 0)
348 mapNameDynamicProperty(property, graphicsItems);
354 std::string currentName =
property.getValue().toString();
356 if(currentName.compare(
"") == 0)
358 currentName =
property.getOptionByCurrentChoice().toString();
363 if(std::find(strList.begin(), strList.end(), currentName) != strList.end())
365 std::vector<std::string>::iterator it = std::find(strList.begin(), strList.end(), currentName);
369 addDynamicOptions(property, strList);
374 if(property.
getName().compare(m_sharedProps->getMapName()) != 0)
377 std::string name =
property.getValue().toString();
378 if(name.compare(
"") == 0)
380 name =
property.getOptionByCurrentChoice().toString();
383 if(name.compare(
"") == 0)
virtual std::vector< Properties * > getAllProperties(QList< QGraphicsItem * > graphicsItems, bool &gridWindow)
virtual bool addProperty(Property property)
TELAYOUTEXPORT MapItem * getMapItem(QList< QGraphicsItem * > graphicsItems, std::string name)
void onChangePropertyValue(Property property)
virtual te::gm::Envelope getBox()=0
virtual void mapNameDynamicProperty(Property &property, QList< QGraphicsItem * > graphicsItems)
virtual MapModel * getMapModel(std::string nameMap)
double getWidth() const
It returns the envelope width.
TELAYOUTEXPORT std::vector< std::string > mapNameList(QList< QGraphicsItem * > graphicsItems)
virtual std::vector< Property > getProperties()
An utility struct for representing 2D coordinates.
virtual Properties * sameProperties(QList< QGraphicsItem * > graphicsItems, bool &gridWindow)
virtual void setObjectName(std::string name)
virtual void changeMapVisitable(Property property)
void setValue(typename ValueType value, LayoutPropertyDataType type)
virtual void checkDynamicProperty(Property &property, QList< QGraphicsItem * > graphicsItems)
PropertiesOutside(OutsideController *controller, Observable *o)
virtual void updateObserver(ContextItem context)
An Envelope defines a 2D rectangular region.
virtual void closeEvent(QCloseEvent *event)
virtual bool hasGridWindows()
PropertiesItemPropertyBrowser * m_layoutPropertyBrowser
virtual std::string getObjectName()
SharedProperties * m_sharedProps
virtual LayoutAbstractObjectType getTypeObj()
virtual void itemsSelected(QList< QGraphicsItem * > graphicsItems, QList< QGraphicsItem * > allItems)
virtual void createLayout()
virtual void setPosition(const double &x, const double &y)
virtual Observable * getModel()
virtual void addDynamicOptions(Property &property, std::vector< std::string > list)
LayoutPropertyDataType getType()
virtual te::gm::Coord2D getPosition()
virtual te::layout::Properties * getProperties() const
virtual Properties * intersection(QList< QGraphicsItem * > graphicsItems, bool &gridWindow)
virtual void setTypeObj(LayoutAbstractObjectType type)
virtual void contains(std::vector< Properties * >::iterator itend, std::vector< Properties * >::iterator it, std::string name, bool &result)
double getHeight() const
It returns the envelope height.
TELAYOUTEXPORT bool changeMapVisitable(QList< QGraphicsItem * > graphicsItems, Visitable *visitable)
virtual void updateProperties(te::layout::Properties *properties)
virtual ~PropertiesOutside()