Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
f9504cd3
Commit
f9504cd3
authored
Sep 02, 2010
by
dt
Browse files
Find Dialog: Update en/disabled state on finishing searching
Makes QTCREATORBUG-2243 easier to do.
parent
7c2d3659
Changes
2
Show whitespace changes
Inline
Side-by-side
src/plugins/find/findtoolwindow.cpp
View file @
f9504cd3
...
...
@@ -45,7 +45,8 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin)
:
QDialog
(
Core
::
ICore
::
instance
()
->
mainWindow
()),
m_plugin
(
plugin
),
m_findCompleter
(
new
QCompleter
(
this
)),
m_currentFilter
(
0
)
m_currentFilter
(
0
),
m_configWidget
(
0
)
{
m_ui
.
setupUi
(
this
);
connect
(
m_ui
.
closeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reject
()));
...
...
@@ -84,11 +85,21 @@ bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
void
FindToolWindow
::
updateButtonStates
()
{
bool
e
nabled
=
!
m_
ui
.
searchT
er
m
->
text
().
isEmpty
()
&&
m_currentFilter
&&
m_currentF
ilter
->
is
Enabled
()
;
bool
filterE
nabled
=
m_
currentFilter
&&
m_currentFilt
er
->
isEnabled
()
;
bool
enabled
=
!
m_ui
.
searchTerm
->
text
().
isEmpty
()
&&
f
ilterEnabled
;
m_ui
.
searchButton
->
setEnabled
(
enabled
);
m_ui
.
replaceButton
->
setEnabled
(
m_currentFilter
&&
m_currentFilter
->
isReplaceSupported
()
&&
enabled
);
if
(
m_configWidget
)
m_configWidget
->
setEnabled
(
filterEnabled
);
m_ui
.
matchCase
->
setEnabled
(
filterEnabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindCaseSensitively
));
m_ui
.
wholeWords
->
setEnabled
(
filterEnabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindWholeWords
));
m_ui
.
regExp
->
setEnabled
(
filterEnabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindRegularExpression
));
m_ui
.
searchTerm
->
setEnabled
(
filterEnabled
);
}
void
FindToolWindow
::
setFindFilters
(
const
QList
<
IFindFilter
*>
&
filters
)
...
...
@@ -135,19 +146,14 @@ void FindToolWindow::setCurrentFilter(int index)
for
(
int
i
=
0
;
i
<
m_configWidgets
.
size
();
++
i
)
{
QWidget
*
configWidget
=
m_configWidgets
.
at
(
i
);
if
(
i
==
index
)
{
m_configWidget
=
configWidget
;
if
(
m_currentFilter
)
disconnect
(
m_currentFilter
,
SIGNAL
(
changed
()),
this
,
SLOT
(
updateButtonStates
()));
m_currentFilter
=
m_filters
.
at
(
i
);
bool
enabled
=
m_currentFilter
->
isEnabled
();
m_ui
.
matchCase
->
setEnabled
(
enabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindCaseSensitively
));
m_ui
.
wholeWords
->
setEnabled
(
enabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindWholeWords
));
m_ui
.
regExp
->
setEnabled
(
enabled
&&
(
m_currentFilter
->
supportedFindFlags
()
&
Find
::
FindRegularExpression
));
m_ui
.
searchTerm
->
setEnabled
(
enabled
);
connect
(
m_currentFilter
,
SIGNAL
(
changed
()),
this
,
SLOT
(
updateButtonStates
()));
updateButtonStates
();
if
(
configWidget
)
{
configWidget
->
setEnabled
(
enabled
);
m_ui
.
configWidget
->
layout
()
->
addWidget
(
configWidget
);
if
(
m_configWidget
)
{
m_ui
.
configWidget
->
layout
()
->
addWidget
(
m_configWidget
);
}
}
else
{
if
(
configWidget
)
...
...
src/plugins/find/findtoolwindow.h
View file @
f9504cd3
...
...
@@ -75,6 +75,7 @@ private:
QCompleter
*
m_findCompleter
;
QWidgetList
m_configWidgets
;
IFindFilter
*
m_currentFilter
;
QWidget
*
m_configWidget
;
};
}
// namespace Internal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment