diff --git a/src/frontends/qt4/FloatPlacement.cpp b/src/frontends/qt4/FloatPlacement.cpp index d8fc52bc95..1f0e6e9709 100644 --- a/src/frontends/qt4/FloatPlacement.cpp +++ b/src/frontends/qt4/FloatPlacement.cpp @@ -222,7 +222,7 @@ void FloatPlacement::changedSlot() } -void FloatPlacement::checkAllowed() +void FloatPlacement::checkAllowed() const { bool const defaults = defaultsCB->isChecked(); bool const ignore = topCB->isChecked() || bottomCB->isChecked() @@ -254,11 +254,14 @@ void FloatPlacement::checkAllowed() bool FloatPlacement::checkWidgets(bool readonly) const { - floatTypeCO->setEnabled(!readonly); - defaultsCB->setEnabled(!readonly); - options->setEnabled(!readonly); - spanCB->setEnabled(!readonly); - sidewaysCB->setEnabled(!readonly); + if (readonly) { + floatTypeCO->setEnabled(false); + defaultsCB->setEnabled(false); + options->setEnabled(false); + spanCB->setEnabled(false); + sidewaysCB->setEnabled(false); + } else + checkAllowed(); return InsetParamsWidget::checkWidgets(); } diff --git a/src/frontends/qt4/FloatPlacement.h b/src/frontends/qt4/FloatPlacement.h index 5aeecc2ded..a720a4e20d 100644 --- a/src/frontends/qt4/FloatPlacement.h +++ b/src/frontends/qt4/FloatPlacement.h @@ -54,7 +54,7 @@ private Q_SLOTS: private: /// - void checkAllowed(); + void checkAllowed() const; /// std::string const get(bool & wide, bool & sideways) const; /// diff --git a/src/frontends/qt4/GuiHSpace.cpp b/src/frontends/qt4/GuiHSpace.cpp index a85037a181..93de4bb695 100644 --- a/src/frontends/qt4/GuiHSpace.cpp +++ b/src/frontends/qt4/GuiHSpace.cpp @@ -99,7 +99,7 @@ void GuiHSpace::changedSlot() } -void GuiHSpace::enableWidgets() +void GuiHSpace::enableWidgets() const { QString const selection = spacingCO->itemData(spacingCO->currentIndex()).toString(); bool const custom = selection == "custom"; @@ -301,11 +301,17 @@ docstring GuiHSpace::dialogToParams() const bool GuiHSpace::checkWidgets(bool readonly) const { - spacingCO->setEnabled(!readonly); - unitCO->setEnabled(!readonly); - fillPatternCO->setEnabled(!readonly); - keepCB->setEnabled(!readonly); valueLE->setReadOnly(readonly); + + if (readonly) { + spacingCO->setEnabled(false); + unitCO->setEnabled(false); + fillPatternCO->setEnabled(false); + keepCB->setEnabled(false); + valueLE->setEnabled(false); + } else + enableWidgets(); + if (!InsetParamsWidget::checkWidgets()) return false; return spacingCO->itemData(spacingCO->currentIndex()).toString() != "custom" diff --git a/src/frontends/qt4/GuiHSpace.h b/src/frontends/qt4/GuiHSpace.h index cc1a80f52c..5b09d7a5d0 100644 --- a/src/frontends/qt4/GuiHSpace.h +++ b/src/frontends/qt4/GuiHSpace.h @@ -29,7 +29,7 @@ private Q_SLOTS: /// void changedSlot(); /// - void enableWidgets(); + void enableWidgets() const; private: /// \name InsetParamsWidget inherited methods diff --git a/src/frontends/qt4/GuiPrintNomencl.cpp b/src/frontends/qt4/GuiPrintNomencl.cpp index 93e00e9b4c..a70a9e091c 100644 --- a/src/frontends/qt4/GuiPrintNomencl.cpp +++ b/src/frontends/qt4/GuiPrintNomencl.cpp @@ -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); } @@ -104,8 +93,18 @@ docstring GuiPrintNomencl::dialogToParams() const bool GuiPrintNomencl::checkWidgets(bool readonly) const { valueLE->setReadOnly(readonly); - setWidthCO->setEnabled(!readonly); - unitLC->setEnabled(!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( diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 55c3edab26..8f1118bc23 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -199,7 +199,7 @@ void GuiTabular::on_interlinespaceCO_activated(int index) } -void GuiTabular::checkEnabled() +void GuiTabular::enableWidgets() const { // if there is a LaTeX argument, the width and alignment will be overwritten // therefore disable them in this case @@ -320,7 +320,12 @@ void GuiTabular::checkEnabled() multirowOffsetLA->setEnabled(enable_mr); multirowOffsetED->setEnabled(enable_mr); multirowOffsetUnitLC->setEnabled(enable_mr); +} + +void GuiTabular::checkEnabled() +{ + enableWidgets(); changed(); } @@ -1016,37 +1021,41 @@ bool GuiTabular::checkWidgets(bool readonly) const { tabularRowED->setReadOnly(readonly); tabularColumnED->setReadOnly(readonly); - multicolumnCB->setEnabled(!readonly); - multirowCB->setEnabled(!readonly); - specialAlignmentED->setReadOnly(readonly); - rotateCellCB->setEnabled(!readonly); - rotateCellAngleSB->setEnabled(!readonly); - rotateTabularCB->setEnabled(!readonly); - rotateTabularAngleSB->setEnabled(!readonly); - longTabularCB->setEnabled(!readonly); - borders->setEnabled(!readonly); tabularWidthED->setReadOnly(readonly); - tabularWidthUnitLC->setEnabled(!readonly); + specialAlignmentED->setReadOnly(readonly); columnWidthED->setReadOnly(readonly); - columnWidthUnitLC->setEnabled(!readonly); multirowOffsetED->setReadOnly(readonly); - multirowOffsetUnitLC->setEnabled(!readonly); - setBordersGB->setEnabled(!readonly); - allBordersGB->setEnabled(!readonly); - borderStyleGB->setEnabled(!readonly); - booktabsRB->setEnabled(!readonly); - topspaceCO->setEnabled(!readonly); - topspaceUnitLC->setEnabled(!readonly); - bottomspaceCO->setEnabled(!readonly); - bottomspaceUnitLC->setEnabled(!readonly); - interlinespaceCO->setEnabled(!readonly); - interlinespaceUnitLC->setEnabled(!readonly); - hAlignCO->setEnabled(!readonly); decimalPointED->setReadOnly(readonly); - vAlignCO->setEnabled(!readonly); - TableAlignCO->setEnabled(!readonly); - longtableGB->setEnabled(!readonly); - alignmentGB->setEnabled(!readonly); + + if (readonly) { + multicolumnCB->setEnabled(false); + multirowCB->setEnabled(false); + rotateCellCB->setEnabled(false); + rotateCellAngleSB->setEnabled(false); + rotateTabularCB->setEnabled(false); + rotateTabularAngleSB->setEnabled(false); + longTabularCB->setEnabled(false); + borders->setEnabled(false); + tabularWidthUnitLC->setEnabled(false); + columnWidthUnitLC->setEnabled(false); + multirowOffsetUnitLC->setEnabled(false); + setBordersGB->setEnabled(false); + allBordersGB->setEnabled(false); + borderStyleGB->setEnabled(false); + booktabsRB->setEnabled(false); + topspaceCO->setEnabled(false); + topspaceUnitLC->setEnabled(false); + bottomspaceCO->setEnabled(false); + bottomspaceUnitLC->setEnabled(false); + interlinespaceCO->setEnabled(false); + interlinespaceUnitLC->setEnabled(false); + hAlignCO->setEnabled(false); + vAlignCO->setEnabled(false); + TableAlignCO->setEnabled(false); + longtableGB->setEnabled(false); + alignmentGB->setEnabled(false); + } else + enableWidgets(); return InsetParamsWidget::checkWidgets(); } diff --git a/src/frontends/qt4/GuiTabular.h b/src/frontends/qt4/GuiTabular.h index a354a4a220..c19e066ddb 100644 --- a/src/frontends/qt4/GuiTabular.h +++ b/src/frontends/qt4/GuiTabular.h @@ -47,6 +47,8 @@ private: bool checkWidgets(bool readonly) const; //@} + /// + void enableWidgets() const; /// void setHAlign(std::string & param_str) const; /// diff --git a/src/frontends/qt4/GuiVSpace.cpp b/src/frontends/qt4/GuiVSpace.cpp index 3756b15560..4ac4c69b82 100644 --- a/src/frontends/qt4/GuiVSpace.cpp +++ b/src/frontends/qt4/GuiVSpace.cpp @@ -150,10 +150,18 @@ void GuiVSpace::paramsToDialog(Inset const * inset) bool GuiVSpace::checkWidgets(bool readonly) const { valueLE->setReadOnly(readonly); - spacingCO->setEnabled(!readonly); - unitCO->setEnabled(!readonly); keepCB->setEnabled(!readonly); + if (readonly) { + spacingCO->setEnabled(false); + unitCO->setEnabled(false); + } else { + bool const enable = (spacingCO->currentIndex() == 5); + valueLE->setEnabled(enable); + valueL->setEnabled(enable); + unitCO->setEnabled(enable); + } + return InsetParamsWidget::checkWidgets(); }