]> 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 1e41e3e93b1e508b467e14dc6f033640c947320d..a70a9e091ce535d2eda06467e16c19e94e8f95f4 100644 (file)
@@ -53,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();
 }
 
@@ -68,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);
 }
 
 
@@ -101,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(