forked from qt-creator/qt-creator
Core: Overload the search button activation
The search button was enabled if there was some text in the search term line edit. If the search term line edit is not used than we need a different mechanism to enable the search button. Change-Id: I5b168447c125199920e82d7990dbdd1a85dff1d7 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -140,7 +140,8 @@ bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
|
|||||||
void FindToolWindow::updateButtonStates()
|
void FindToolWindow::updateButtonStates()
|
||||||
{
|
{
|
||||||
bool filterEnabled = m_currentFilter && m_currentFilter->isEnabled();
|
bool filterEnabled = m_currentFilter && m_currentFilter->isEnabled();
|
||||||
bool enabled = m_ui.searchTerm->isValid() && filterEnabled && m_currentFilter->isValid();
|
bool enabled = filterEnabled && (!m_currentFilter->showSearchTermInput()
|
||||||
|
|| m_ui.searchTerm->isValid()) && m_currentFilter->isValid();
|
||||||
m_ui.searchButton->setEnabled(enabled);
|
m_ui.searchButton->setEnabled(enabled);
|
||||||
m_ui.replaceButton->setEnabled(m_currentFilter
|
m_ui.replaceButton->setEnabled(m_currentFilter
|
||||||
&& m_currentFilter->isReplaceSupported() && enabled);
|
&& m_currentFilter->isReplaceSupported() && enabled);
|
||||||
@@ -268,12 +269,12 @@ void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
|
|||||||
Find::updateFindCompletion(m_ui.searchTerm->text());
|
Find::updateFindCompletion(m_ui.searchTerm->text());
|
||||||
int index = m_ui.filterList->currentIndex();
|
int index = m_ui.filterList->currentIndex();
|
||||||
QString searchTerm = m_ui.searchTerm->text();
|
QString searchTerm = m_ui.searchTerm->text();
|
||||||
|
if (filter && index >= 0)
|
||||||
|
*filter = m_filters.at(index);
|
||||||
if (term)
|
if (term)
|
||||||
*term = searchTerm;
|
*term = searchTerm;
|
||||||
if (searchTerm.isEmpty() || index < 0)
|
if (searchTerm.isEmpty() && *filter && !(*filter)->isValid())
|
||||||
return;
|
*filter = 0;
|
||||||
if (filter)
|
|
||||||
*filter = m_filters.at(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolWindow::search()
|
void FindToolWindow::search()
|
||||||
|
Reference in New Issue
Block a user