[LyX/master] Prevent permanent disabling of comboboxes in Vertical/Horizontal space dialogs

Juergen Spitzmueller spitz at lyx.org
Fri Aug 28 04:42:03 UTC 2020


commit 3bd358a2f6cfe9bc585b23292a085e638fea0796
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date:   Fri Aug 28 02:03:23 2020 +0300

    Prevent permanent disabling of comboboxes in Vertical/Horizontal space dialogs
---
 src/frontends/qt/GuiHSpace.cpp |   10 +++++++---
 src/frontends/qt/GuiVSpace.cpp |   21 +++++++++++----------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/frontends/qt/GuiHSpace.cpp b/src/frontends/qt/GuiHSpace.cpp
index 9a14370..64c5b38 100644
--- a/src/frontends/qt/GuiHSpace.cpp
+++ b/src/frontends/qt/GuiHSpace.cpp
@@ -293,13 +293,17 @@ docstring GuiHSpace::dialogToParams() const
 bool GuiHSpace::checkWidgets(bool readonly) const
 {
 	valueLE->setReadOnly(readonly);
-
+	spacingCO->setEnabled(!readonly);
+	spacingL->setEnabled(!readonly);
+	
 	if (readonly) {
-		spacingCO->setEnabled(false);
-		unitCO->setEnabled(false);
 		fillPatternCO->setEnabled(false);
+		fillPatternL->setEnabled(false);
 		keepCB->setEnabled(false);
+		keepL->setEnabled(false);
 		valueLE->setEnabled(false);
+		valueL->setEnabled(false);
+		unitCO->setEnabled(false);
 	} else
 		enableWidgets();
 
diff --git a/src/frontends/qt/GuiVSpace.cpp b/src/frontends/qt/GuiVSpace.cpp
index 96fa016..7163634 100644
--- a/src/frontends/qt/GuiVSpace.cpp
+++ b/src/frontends/qt/GuiVSpace.cpp
@@ -188,18 +188,19 @@ void GuiVSpace::paramsToDialog(Inset const * inset)
 
 bool GuiVSpace::checkWidgets(bool readonly) const
 {
-	valueLE->setReadOnly(readonly);
 	keepCB->setEnabled(!readonly);
+	keepL->setEnabled(!readonly);
+	spacingCO->setEnabled(!readonly);
+	spacingL->setEnabled(!readonly);
 
-	if (readonly) {
-		spacingCO->setEnabled(false);
-		unitCO->setEnabled(false);
-	} else {
-		bool const enable = (spacingCO->currentIndex() == 7);
-		valueLE->setEnabled(enable);
-		valueL->setEnabled(enable);
-		unitCO->setEnabled(enable);
-	}
+	valueLE->setReadOnly(readonly);
+
+	bool const enable_custom =
+		!readonly && (spacingCO->currentIndex() == 7);
+
+	valueL->setEnabled(enable_custom);
+	valueLE->setEnabled(enable_custom);
+	unitCO->setEnabled(enable_custom);
 
 	return InsetParamsWidget::checkWidgets();
 }


More information about the lyx-cvs mailing list