diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 8dd3815..5ca6575 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -743,6 +743,7 @@ void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item) m_objectInspector->commitActiveEditorData(); m_propertyModel->setObject(item); + if (m_propertyModel->subclassesAsLevel()) m_objectInspector->expandToDepth(0); @@ -777,7 +778,7 @@ void ReportDesignWindow::slotItemSelected(LimeReport::BaseDesignIntf *item) m_fontEditorBar->setItem(item); m_textAlignmentEditorBar->setItem(item); m_itemsBordersEditorBar->setItem(item); - } + } else {m_propertyModel->clearObjectsList();} } void ReportDesignWindow::slotItemPropertyChanged(const QString &objectName, const QString &propertyName, const QVariant& oldValue, const QVariant& newValue ) diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 9dd045a..a120b84 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -85,6 +85,11 @@ void QObjectPropertyModel::translatePropertyName() tr("shapeBrushColor"); } +void QObjectPropertyModel::clearObjectsList() +{ + m_objects.clear(); +} + QObjectPropertyModel::QObjectPropertyModel(QObject *parent/*=0*/) :QAbstractItemModel(parent),m_rootNode(0),m_object(0),m_dataChanging(false), m_subclassesAsLevel(true), m_validator(0) {} @@ -354,13 +359,9 @@ void QObjectPropertyModel::addObjectProperties(const QMetaObject *metaObject, QO objectNode = m_rootNode; } - //m_rootNode->appendItem(objectNode); - for (int i=metaObject->propertyOffset();ipropertyCount();i++){ if (metaObject->property(i).isDesignable()){ ObjectPropItem* prop=createPropertyItem(metaObject->property(i),object,objects,objectNode); - //ObjectPropItem* prop=createPropertyItem(metaObject->property(i),object,objects,m_rootNode); - //m_rootNode->appendItem(prop); objectNode->appendItem(prop); } } diff --git a/limereport/objectinspector/lrobjectitemmodel.h b/limereport/objectinspector/lrobjectitemmodel.h index 98e917f..bf01cb2 100644 --- a/limereport/objectinspector/lrobjectitemmodel.h +++ b/limereport/objectinspector/lrobjectitemmodel.h @@ -71,6 +71,7 @@ public: ValidatorIntf* validator() const; void setValidator(ValidatorIntf* validator); void translatePropertyName(); + void clearObjectsList(); signals: void objectPropetyChanged(const QString& , const QVariant&, const QVariant&); private slots: diff --git a/limereport/objectinspector/lrobjectpropitem.cpp b/limereport/objectinspector/lrobjectpropitem.cpp index fa516ff..38aeb2a 100644 --- a/limereport/objectinspector/lrobjectpropitem.cpp +++ b/limereport/objectinspector/lrobjectpropitem.cpp @@ -46,7 +46,8 @@ ObjectPropItem::ObjectPropItem(QObject *object, ObjectsList* objects, const QStr { if (parent) setModel(parent->model()); m_index=QModelIndex(); - if (objects) foreach(QObject* item, *objects) m_objects.append(item); + //if (objects) foreach(QObject* item, *objects) m_objects.append(item); + m_objects = objects; #ifdef INSPECT_BASEDESIGN BaseDesignIntf * item = dynamic_cast(object); if (item){ @@ -63,7 +64,8 @@ ObjectPropItem::ObjectPropItem(QObject *object, ObjectsList* objects, const QStr { if (parent) setModel(parent->model()); m_index=QModelIndex(); - if (objects) foreach(QObject* item, *objects) m_objects.append(item); + //if (objects) foreach(QObject* item, *objects) m_objects.append(item); + m_objects = objects; #ifdef INSPECT_BASEDESIGN BaseDesignIntf * item = dynamic_cast(object); if (item){ diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index c78cf69..2ff3553 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -73,7 +73,7 @@ namespace LimeReport{ ObjectPropItem* parent() const{ return m_parent;} QObject* object() const{return m_object;} - ObjectsList* objects() {return &m_objects;} + ObjectsList* objects() {return m_objects;} ObjectPropItem* child(int row); QList children(){return m_childItems;} ObjectPropItem* findChild(const QString& propertyName); @@ -106,7 +106,7 @@ namespace LimeReport{ void setValueToObject(const QString& propertyName, QVariant propertyValue); private: QObject* m_object; - ObjectsList m_objects; + ObjectsList* m_objects; QString m_name; QString m_displayName; QVariant m_value;