]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrintNomencl.cpp
Properly track the lifetime of signals2::slots (#8261)
[lyx.git] / src / frontends / qt4 / GuiPrintNomencl.cpp
index b287d44eb6a23b2030140cbfef430eb287ca74a2..a70a9e091ce535d2eda06467e16c19e94e8f95f4 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "insets/InsetNomencl.h"
 
+#include "support/debug.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
@@ -52,13 +53,8 @@ GuiPrintNomencl::GuiPrintNomencl(QWidget * parent) : InsetParamsWidget(parent)
 }
 
 
-void GuiPrintNomencl::on_setWidthCO_activated(int i)
+void GuiPrintNomencl::on_setWidthCO_activated(int /*i*/)
 {
-       bool const custom =
-               (setWidthCO->itemData(i).toString() == "custom");
-       valueLE->setEnabled(custom);
-       unitLC->setEnabled(custom);
-       valueLA->setEnabled(custom);
        changed();
 }
 
@@ -67,15 +63,9 @@ void GuiPrintNomencl::paramsToDialog(InsetCommandParams const & params)
 {
        setWidthCO->setCurrentIndex(
                setWidthCO->findData(toqstr(params["set_width"])));
-       
+
        lengthToWidgets(valueLE, unitLC,
                        params["width"], Length::defaultUnit());
-
-       bool const custom =
-               (setWidthCO->itemData(setWidthCO->currentIndex()).toString() == "custom");
-       valueLE->setEnabled(custom);
-       unitLC->setEnabled(custom);
-       valueLA->setEnabled(custom);
 }
 
 
@@ -100,8 +90,21 @@ docstring GuiPrintNomencl::dialogToParams() const
 }
 
 
-bool GuiPrintNomencl::checkWidgets() const
+bool GuiPrintNomencl::checkWidgets(bool readonly) const
 {
+       valueLE->setReadOnly(readonly);
+       if (readonly) {
+               setWidthCO->setEnabled(false);
+               unitLC->setEnabled(false);
+               valueLA->setEnabled(false);
+       } else {
+               bool const custom =
+                       (setWidthCO->itemData(setWidthCO->currentIndex()).toString() == "custom");
+               valueLE->setEnabled(custom);
+               unitLC->setEnabled(custom);
+               valueLA->setEnabled(custom);
+       }
+
        if (!InsetParamsWidget::checkWidgets())
                return false;
        return setWidthCO->itemData(