Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/QmlControls/ParameterEditorController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ QGC_LOGGING_CATEGORY(ParameterEditorControllerLog, "qgc.qmlcontrols.parameteredi
ParameterEditorController::ParameterEditorController(QObject *parent)
: FactPanelController(parent)
, _parameterMgr(_vehicle->parameterManager())
, _searchTimer(new QTimer(this))
{
// qCDebug(ParameterEditorControllerLog) << Q_FUNC_INFO << this;

_buildLists();

_searchTimer->setSingleShot(true);
_searchTimer->setInterval(300);

connect(this, &ParameterEditorController::currentCategoryChanged, this, &ParameterEditorController::_currentCategoryChanged);
connect(this, &ParameterEditorController::currentGroupChanged, this, &ParameterEditorController::_currentGroupChanged);
connect(this, &ParameterEditorController::searchTextChanged, this, &ParameterEditorController::_searchTextChanged);
connect(this, &ParameterEditorController::showModifiedOnlyChanged, this, &ParameterEditorController::_searchTextChanged);

connect(_parameterMgr, &ParameterManager::factAdded, this, &ParameterEditorController::_factAdded);
connect(_searchTimer, &QTimer::timeout, this, &ParameterEditorController::_performSearch);
connect(_parameterMgr, &ParameterManager::factAdded, this, &ParameterEditorController::_factAdded);

ParameterEditorCategory* category = _categories.count() ? _categories.value<ParameterEditorCategory*>(0) : nullptr;
setCurrentCategory(category);
Expand Down Expand Up @@ -370,6 +374,13 @@ bool ParameterEditorController::_shouldShow(Fact* fact) const
}

void ParameterEditorController::_searchTextChanged(void)
{
if (!_searchTimer->isActive()) {
_searchTimer->start();
}
}

void ParameterEditorController::_performSearch(void)
{
QObjectList newParameterList;

Expand Down
3 changes: 3 additions & 0 deletions src/QmlControls/ParameterEditorController.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ private slots:
private:
bool _shouldShow(Fact *fact) const;

void _performSearch();

private:
ParameterManager* _parameterMgr = nullptr;
QString _searchText;
QTimer* _searchTimer;
ParameterEditorCategory* _currentCategory = nullptr;
ParameterEditorGroup* _currentGroup = nullptr;
bool _showModifiedOnly = false;
Expand Down
Loading