forked from qt-creator/qt-creator
Extend search pane
The search term line edit can now be hidden away and the options are hidden too too if they are all disabled. Change-Id: I2363d010acbdabb2abfc6c6cd2f98c07cd7d3a3d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="searchLabel">
|
||||
<property name="text">
|
||||
<string>Sear&ch for:</string>
|
||||
</property>
|
||||
@@ -73,7 +73,16 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -103,9 +112,18 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QWidget" name="optionsWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@@ -147,6 +147,13 @@ void FindToolWindow::updateButtonStates()
|
||||
if (m_configWidget)
|
||||
m_configWidget->setEnabled(filterEnabled);
|
||||
|
||||
if (m_currentFilter) {
|
||||
m_ui.searchTerm->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_ui.searchLabel->setVisible(m_currentFilter->showSearchTermInput());
|
||||
m_ui.optionsWidget->setVisible(m_currentFilter->supportedFindFlags()
|
||||
& (FindCaseSensitively | FindWholeWords | FindRegularExpression));
|
||||
}
|
||||
|
||||
m_ui.matchCase->setEnabled(filterEnabled
|
||||
&& (m_currentFilter->supportedFindFlags() & FindCaseSensitively));
|
||||
m_ui.wholeWords->setEnabled(filterEnabled
|
||||
|
@@ -142,6 +142,14 @@
|
||||
your find filter supports global search and replace.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool showSearchTermInput() const
|
||||
Returns whether the find filter wants to show the search term line edit.
|
||||
|
||||
The default value is \c true, override this function to return \c false, if
|
||||
your find filter does not want to show the search term line edit.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void IFindFilter::findAll(const QString &txt, Core::FindFlags findFlags)
|
||||
This function is called when the user selected this find scope and
|
||||
@@ -227,7 +235,8 @@ QKeySequence IFindFilter::defaultShortcut() const
|
||||
FindFlags IFindFilter::supportedFindFlags() const
|
||||
{
|
||||
return FindCaseSensitively
|
||||
| FindRegularExpression | FindWholeWords;
|
||||
| FindRegularExpression
|
||||
| FindWholeWords;
|
||||
}
|
||||
|
||||
QPixmap IFindFilter::pixmapForFindFlags(FindFlags flags)
|
||||
|
@@ -50,6 +50,7 @@ public:
|
||||
virtual bool isValid() const { return true; }
|
||||
virtual QKeySequence defaultShortcut() const;
|
||||
virtual bool isReplaceSupported() const { return false; }
|
||||
virtual bool showSearchTermInput() const { return true; }
|
||||
virtual FindFlags supportedFindFlags() const;
|
||||
|
||||
virtual void findAll(const QString &txt, FindFlags findFlags) = 0;
|
||||
|
@@ -100,11 +100,6 @@ void SymbolsFindFilter::setPaused(bool paused)
|
||||
watcher->setPaused(paused);
|
||||
}
|
||||
|
||||
FindFlags SymbolsFindFilter::supportedFindFlags() const
|
||||
{
|
||||
return FindCaseSensitively | FindRegularExpression | FindWholeWords;
|
||||
}
|
||||
|
||||
void SymbolsFindFilter::findAll(const QString &txt, FindFlags findFlags)
|
||||
{
|
||||
SearchResultWindow *window = SearchResultWindow::instance();
|
||||
|
@@ -56,7 +56,6 @@ public:
|
||||
QString id() const;
|
||||
QString displayName() const;
|
||||
bool isEnabled() const;
|
||||
Core::FindFlags supportedFindFlags() const;
|
||||
|
||||
void findAll(const QString &txt, Core::FindFlags findFlags);
|
||||
|
||||
|
Reference in New Issue
Block a user