void OSObjectListCBDS::initialize() { std::vector<model::ModelObject> modelObjects = m_model.getModelObjects<model::ModelObject>(); for( std::vector<model::ModelObject>::iterator it = modelObjects.begin(); it < modelObjects.end(); it++ ) { if( std::find(m_types.begin(),m_types.end(),it->iddObjectType()) != m_types.end() ) { m_workspaceObjects << *it; connect( it->getImpl<openstudio::model::detail::ModelObject_Impl>().get(), SIGNAL(onChange()), this, SLOT(onObjectChanged()) ); } } connect( m_model.getImpl<openstudio::model::detail::Model_Impl>().get(), SIGNAL(addWorkspaceObject(const WorkspaceObject&, const openstudio::IddObjectType&, const openstudio::UUID&)), this, SLOT(onObjectAdded(const WorkspaceObject&)) ); connect( m_model.getImpl<openstudio::model::detail::Model_Impl>().get(), SIGNAL(removeWorkspaceObject(const WorkspaceObject&, const openstudio::IddObjectType&, const openstudio::UUID&)), this, SLOT(onObjectWillBeRemoved(const WorkspaceObject&)) ); }
ModelObjectItem::ModelObjectItem(const openstudio::model::ModelObject& modelObject, bool isDefaulted, OSItem::Type type, QWidget * parent ) : OSItem(modelObjectToItemId(modelObject, isDefaulted), type, parent), m_handle(modelObject.handle()), m_modelObject(modelObject) { this->setText(QString::fromStdString(m_modelObject.name().get())); bool isConnected = false; isConnected = connect( m_modelObject.getImpl<openstudio::model::detail::ModelObject_Impl>().get(), SIGNAL(onChange()), this, SLOT(onObjectChanged()) ); OS_ASSERT(isConnected); if (!modelObject.getModelObjectSources<model::ComponentData>().empty()){ m_bclBadge->setVisible(true); } }
void OSObjectListCBDS::onObjectAdded(const WorkspaceObject & workspaceObject) { if(std::find(m_types.begin(),m_types.end(),workspaceObject.cast<model::ModelObject>().iddObjectType()) != m_types.end()) { m_workspaceObjects << workspaceObject; connect( workspaceObject.getImpl<openstudio::model::detail::ModelObject_Impl>().get(), SIGNAL(onChange()), this, SLOT(onObjectChanged()) ); if( m_allowEmptySelection ) { emit itemAdded(m_workspaceObjects.size()); } else { emit itemAdded(m_workspaceObjects.size() - 1); } } }
mUntitledInstance = savedModel->mUntitledInstance; mModified = savedModel->mModified; mFileName = savedModel->mFileName; mCompressionLevel = savedModel->mCompressionLevel; mTmplate = savedModel->mTmplate; mFrame = savedModel->mFrame; mRotate = savedModel->mRotate; foreach ( LabelModelObject* savedObject, savedModel->mObjectList ) { LabelModelObject* object = savedObject->clone(); object->setParent( this ); mObjectList << object; connect( object, SIGNAL(changed()), this, SLOT(onObjectChanged()) ); connect( object, SIGNAL(moved()), this, SLOT(onObjectMoved()) ); } delete mMerge; mMerge = savedModel->mMerge->clone(); // Emit signals based on potential changes emit changed(); emit selectionChanged(); emit modifiedChanged(); emit nameChanged(); emit sizeChanged(); emit mergeChanged(); emit mergeSourceChanged(); emit mergeSelectionChanged();