]> 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 2054f599442a5545684910913f0623f796cae068..a70a9e091ce535d2eda06467e16c19e94e8f95f4 100644 (file)
@@ -53,14 +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();
 }
 
@@ -69,11 +63,9 @@ void GuiPrintNomencl::paramsToDialog(InsetCommandParams const & params)
 {
        setWidthCO->setCurrentIndex(
                setWidthCO->findData(toqstr(params["set_width"])));
-       
-       lengthToWidgets(valueLE,
-                       unitLC,
-                       params["width"],
-                       Length::defaultUnit());
+
+       lengthToWidgets(valueLE, unitLC,
+                       params["width"], Length::defaultUnit());
 }
 
 
@@ -98,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(