ui: added find shortcut to set focus in search view

The shortcut is added to the new Find menubar item and dispatches a MessageFind, which is handled by the
SearchController. QtSearchView assures via the ViewLayout that the view is visible when setting focus on the search box.
This commit is contained in:
Eberhard Graether
2014-07-17 14:38:18 +02:00
parent 75e1cb7229
commit 4578c109ec
14 changed files with 128 additions and 15 deletions
+12
View File
@@ -12,6 +12,7 @@
QtSearchView::QtSearchView(ViewLayout* viewLayout)
: SearchView(viewLayout)
, m_setTextFunctor(std::bind(&QtSearchView::doSetText, this, std::placeholders::_1))
, m_setFocusFunctor(std::bind(&QtSearchView::doSetFocus, this))
, m_setAutocompletionListFunctor(std::bind(&QtSearchView::doSetAutocompletionList, this, std::placeholders::_1))
{
}
@@ -59,6 +60,11 @@ void QtSearchView::setText(const std::string& s)
m_setTextFunctor(s);
}
void QtSearchView::setFocus()
{
m_setFocusFunctor();
}
void QtSearchView::setAutocompletionList(const std::vector<std::string>& autocompletionList)
{
m_setAutocompletionListFunctor(autocompletionList);
@@ -81,6 +87,12 @@ void QtSearchView::doSetText(const std::string& s)
}
}
void QtSearchView::doSetFocus()
{
getViewLayout()->showView(this);
m_searchBox->setFocus(Qt::ShortcutFocusReason);
}
void QtSearchView::doSetAutocompletionList(const std::vector<std::string>& autocompletionList)
{
QStringList wordList;