[LyX/master] Fix disabling of widgets for (simple) Search dialog
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Thu Dec 3 14:15:12 UTC 2020
commit 24b71d30d56752231fb8cb8f3dc65cc21f83d614
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Thu Dec 3 15:31:35 2020 +0100
Fix disabling of widgets for (simple) Search dialog
This allows to remove the calls to ButtonController::addReadonly,
which are placebo since 78ade7e6.
---
src/frontends/qt/GuiSearch.cpp | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/frontends/qt/GuiSearch.cpp b/src/frontends/qt/GuiSearch.cpp
index 1d209a2..e582126 100644
--- a/src/frontends/qt/GuiSearch.cpp
+++ b/src/frontends/qt/GuiSearch.cpp
@@ -66,9 +66,6 @@ GuiSearch::GuiSearch(GuiView & lv)
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
bc().setCancel(buttonBox->button(QDialogButtonBox::Close));
- bc().addReadOnly(replaceCO);
- bc().addReadOnly(replacePB);
- bc().addReadOnly(replaceallPB);
findCO->setCompleter(0);
replaceCO->setCompleter(0);
@@ -80,6 +77,7 @@ GuiSearch::GuiSearch(GuiView & lv)
void GuiSearch::showEvent(QShowEvent * e)
{
+ findChanged();
findPB->setFocus();
findCO->lineEdit()->selectAll();
GuiDialog::showEvent(e);
@@ -88,15 +86,12 @@ void GuiSearch::showEvent(QShowEvent * e)
void GuiSearch::findChanged()
{
- if (findCO->currentText().isEmpty()) {
- findPB->setEnabled(false);
- replacePB->setEnabled(false);
- replaceallPB->setEnabled(false);
- } else {
- findPB->setEnabled(true);
- replacePB->setEnabled(!isBufferReadonly());
- replaceallPB->setEnabled(!isBufferReadonly());
- }
+ bool const replace = !findCO->currentText().isEmpty() && !isBufferReadonly();
+ findPB->setEnabled(replace);
+ replacePB->setEnabled(replace);
+ replaceallPB->setEnabled(replace);
+ replaceLA->setEnabled(replace);
+ replaceCO->setEnabled(replace);
}
More information about the lyx-cvs
mailing list