36 #include <MemoryX/gui-plugins/SceneEditor/ui_ObjectExplorerWidget.h>
48 ui->objectExplorerTreeView->setModel(sourceModel);
50 std::shared_ptr<gui::ShortcutController> shortcutController =
control->getShortcutController();
51 QPointer<QAction> searchAction(
new OverrideAction(
"Object Explorer: Set Focus on Search Field",
this));
52 this->addAction(searchAction);
53 shortcutController->registerAction(searchAction->text(), searchAction);
57 connect(searchAction, SIGNAL(triggered()), ui->filterObjectClassesLineEdit, SLOT(setFocus()));
58 connect(ui->filterObjectClassesLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(filterFixedString()));
59 connect(ui->objectExplorerTreeView, SIGNAL(clicked(QModelIndex)),
this, SLOT(getSelectedObject(QModelIndex)));
62 void gui::ObjectExplorerWidget::filterFixedString()
64 QString searchPattern(ui->filterObjectClassesLineEdit->text());
65 sourceModel->setFilterFixedString(searchPattern);
67 if (searchPattern.isEmpty())
69 ui->objectExplorerTreeView->collapseAll();
73 ui->objectExplorerTreeView->expandAll();
78 void gui::ObjectExplorerWidget::getSelectedObject(
const QModelIndex&
index)
80 std::pair<std::string, std::string>
object = sourceModel->getItemInformation(
index);
82 if (!
object.first.empty() && !
object.second.empty())
86 controller->triggerObjectClassSelected(
object.first,
object.second);
93 sourceModel->onConnect();
94 ui->objectExplorerTreeView->setModel(sourceModel);
104 ui->retranslateUi(
this);