ModelObjectItem::ModelObjectItem(const openstudio::model::ModelObject& modelObject, bool isDefaulted, OSItemType type, QWidget * parent ) : OSItem(modelObjectToItemId(modelObject, isDefaulted), type, parent), m_handle(modelObject.handle()), m_modelObject(modelObject) { this->setText(QString::fromStdString(m_modelObject.name().get())); connect(m_modelObject.getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onChange, this, &ModelObjectItem::onObjectChanged); if (!modelObject.getModelObjectSources<model::ComponentData>().empty()){ m_measureBadge->setMeasureBadgeType(MeasureBadgeType::BCLMeasure); } }
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); } }
OSItemId modelObjectToItemId(const openstudio::model::ModelObject& modelObject, bool isDefaulted) { std::stringstream ss; ss << modelObject; return OSItemId(modelObject.handle().toString(), modelToSourceId(modelObject.model()), isDefaulted, toQString(ss.str())); }