focus search input field when opening search subview (Fixes #2534)

c++11
Marc Zinnschlag 10 years ago
parent 7f12fc4770
commit c9d519f36c

@ -153,6 +153,11 @@ void CSVTools::SearchBox::setEditLock (bool locked)
mReplace.setEnabled (!locked); mReplace.setEnabled (!locked);
} }
void CSVTools::SearchBox::focus()
{
mInput.currentWidget()->setFocus();
}
void CSVTools::SearchBox::modeSelected (int index) void CSVTools::SearchBox::modeSelected (int index)
{ {
switch (index) switch (index)
@ -172,6 +177,8 @@ void CSVTools::SearchBox::modeSelected (int index)
break; break;
} }
mInput.currentWidget()->setFocus();
updateSearchButton(); updateSearchButton();
} }

@ -49,6 +49,8 @@ namespace CSVTools
void setEditLock (bool locked); void setEditLock (bool locked);
void focus();
private slots: private slots:
void modeSelected (int index); void modeSelected (int index);

@ -60,6 +60,12 @@ void CSVTools::SearchSubView::replace (bool selection)
} }
} }
void CSVTools::SearchSubView::showEvent (QShowEvent *event)
{
CSVDoc::SubView::showEvent (event);
mSearchBox.focus();
}
CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
: CSVDoc::SubView (id), mDocument (document), mLocked (false) : CSVDoc::SubView (id), mDocument (document), mLocked (false)
{ {

@ -33,6 +33,10 @@ namespace CSVTools
void replace (bool selection); void replace (bool selection);
protected:
void showEvent (QShowEvent *event);
public: public:
SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document); SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);

Loading…
Cancel
Save