fix some on properties and signal connection

This commit is contained in:
AndreaRigoni
2026-03-26 09:50:52 +00:00
parent 2c5d6842c3
commit e0ffeff5b7
22 changed files with 578 additions and 62 deletions

View File

@@ -92,3 +92,27 @@ void ContextPanel::onSelectionChanged(const QItemSelection& selected, const QIte
emit objectSelected(target);
m_propertiesPanel->setObject(target);
}
void ContextPanel::selectObject(uLib::Object* obj) {
if (!obj) {
clearSelection();
return;
}
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex idx = m_model->index(i, 0);
if (idx.internalPointer() == obj) {
QSignalBlocker blocker(m_treeView->selectionModel());
m_treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
m_treeView->scrollTo(idx);
m_propertiesPanel->setObject(obj); // Explicitly update properties too
return;
}
}
}
void ContextPanel::clearSelection() {
QSignalBlocker blocker(m_treeView->selectionModel());
m_treeView->selectionModel()->clearSelection();
m_propertiesPanel->setObject(nullptr);
}