void InternalMassDefinitionInspectorView::ConstructionVectorController::onChangeRelationship( const openstudio::model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle) { if( index == OS_InternalMass_DefinitionFields::ConstructionName ) { reportItems(); } }
OSItemList::OSItemList(OSVectorController* vectorController, bool addScrollArea, QWidget * parent) : OSItemSelector(parent), m_vectorController(vectorController), m_vLayout(nullptr), m_selectedItem(nullptr), m_itemsDraggable(false), m_itemsRemoveable(false), m_type(OSItemType::ListItem), m_dirty(false) { // for now we will allow this item list to manage memory of OS_ASSERT(!m_vectorController->parent()); m_vectorController->setParent(this); this->setObjectName("GrayWidget"); QString style; style.append("QWidget#GrayWidget {"); style.append(" background: #E6E6E6;"); style.append(" border-bottom: 1px solid black;"); style.append("}"); setStyleSheet(style); auto outerVLayout = new QVBoxLayout(); outerVLayout->setContentsMargins(0,0,0,0); this->setLayout(outerVLayout); auto outerWidget = new QWidget(); if (addScrollArea){ auto scrollArea = new QScrollArea(); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); outerVLayout->addWidget(scrollArea); scrollArea->setWidget(outerWidget); scrollArea->setWidgetResizable(true); }else{ outerVLayout->addWidget(outerWidget); } m_vLayout = new QVBoxLayout(); outerWidget->setLayout(m_vLayout); m_vLayout->setContentsMargins(0,0,0,0); m_vLayout->setSpacing(0); m_vLayout->addStretch(); connect(this, &OSItemList::itemsRequested, vectorController, &OSVectorController::reportItems); /* Vector controller does not handle removing items in list from model * connect(this, &OSItemList::itemRemoveClicked, vectorController, &OSVectorController::removeItem); */ connect(vectorController, &OSVectorController::itemIds, this, &OSItemList::setItemIds); connect(vectorController, &OSVectorController::selectedItemId, this, &OSItemList::selectItemId); // allow time for OSDocument to finish constructing QTimer::singleShot(0, vectorController, SLOT(reportItems())); }