diff --git a/include/ControlLayout.h b/include/ControlLayout.h index 625b3f468..601820107 100644 --- a/include/ControlLayout.h +++ b/include/ControlLayout.h @@ -110,6 +110,9 @@ public: void setGeometry(const QRect &rect) override; QSize sizeHint() const override; QLayoutItem *takeAt(int index) override; + //! remove focus from QLineEdit search bar + //! this may be useful if the mouse is outside the layout + void removeFocusFromSearchBar(); private slots: void onTextChanged(const QString&); diff --git a/include/LinkedModelGroupViews.h b/include/LinkedModelGroupViews.h index 79fab76af..390d25568 100644 --- a/include/LinkedModelGroupViews.h +++ b/include/LinkedModelGroupViews.h @@ -71,6 +71,8 @@ protected: void removeControl(const QString &key); + void removeFocusFromSearchBar(); + private: class LinkedModelGroup* m_model; diff --git a/src/gui/widgets/ControlLayout.cpp b/src/gui/widgets/ControlLayout.cpp index ce2e9e4ef..aa265b14e 100644 --- a/src/gui/widgets/ControlLayout.cpp +++ b/src/gui/widgets/ControlLayout.cpp @@ -177,6 +177,11 @@ QLayoutItem *ControlLayout::takeAt(int index) return (itr == m_itemMap.end()) ? nullptr : m_itemMap.take(itr.key()); } +void ControlLayout::removeFocusFromSearchBar() +{ + m_searchBar->clearFocus(); +} + Qt::Orientations ControlLayout::expandingDirections() const { return Qt::Orientations(); diff --git a/src/gui/widgets/LinkedModelGroupViews.cpp b/src/gui/widgets/LinkedModelGroupViews.cpp index 21d40efcc..1b4bd8bbd 100644 --- a/src/gui/widgets/LinkedModelGroupViews.cpp +++ b/src/gui/widgets/LinkedModelGroupViews.cpp @@ -142,6 +142,14 @@ void LinkedModelGroupView::removeControl(const QString& key) } + + +void LinkedModelGroupView::removeFocusFromSearchBar() +{ + m_layout->removeFocusFromSearchBar(); +} + + /* LinkedModelGroupsViewBase */