commit 7a992bb699b661325b652bd34d312854264464d9
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Jan 7 13:05:37 2021 +0100

    GuiParagraph: apply pending changes when setting "immediate apply" (#11592)
---
 src/frontends/qt/GuiParagraph.cpp |   24 +++++++++++++++++-------
 src/frontends/qt/GuiParagraph.h   |    4 +++-
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt/GuiParagraph.cpp 
b/src/frontends/qt/GuiParagraph.cpp
index 432ce28..b3c7349 100644
--- a/src/frontends/qt/GuiParagraph.cpp
+++ b/src/frontends/qt/GuiParagraph.cpp
@@ -75,7 +75,7 @@ GuiParagraph::GuiParagraph(GuiView & lv)
        synchronizedViewCB->setChecked(false);
 #endif
 
-       on_synchronizedViewCB_toggled();
+       setButtons(synchronizedViewCB->isChecked());
        QDoubleValidator * val = new QDoubleValidator(linespacingValue);
        val->setNotation(QDoubleValidator::StandardNotation);
        linespacingValue->setValidator(val);
@@ -155,16 +155,26 @@ LyXAlignment GuiParagraph::getAlignmentFromDialog() const
 }
 
 
-void GuiParagraph::on_synchronizedViewCB_toggled()
+void GuiParagraph::on_synchronizedViewCB_stateChanged(int state)
+{
+       bool in_sync = state == Qt::Checked;
+       setButtons(in_sync);
+
+       // Apply pending changes
+       if (in_sync) 
+               changed();
+}
+
+
+void GuiParagraph::setButtons(bool const in_sync)
 {
-       bool in_sync = synchronizedViewCB->isChecked();
        buttonBox->button(QDialogButtonBox::Reset)->setEnabled(!in_sync);
        buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!in_sync);
        buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!in_sync);
-       if (!in_sync)
-               
buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Cancel"));
-       else
+       if (in_sync) 
                
buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Close"));
+       else
+               
buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Cancel"));
 }
 
 
@@ -246,7 +256,7 @@ void GuiParagraph::applyView()
 
 void GuiParagraph::updateView()
 {
-       on_synchronizedViewCB_toggled();
+       setButtons(synchronizedViewCB->isChecked());
 
        ParagraphParameters const & pp = params();
 
diff --git a/src/frontends/qt/GuiParagraph.h b/src/frontends/qt/GuiParagraph.h
index 4e8d31b..230390e 100644
--- a/src/frontends/qt/GuiParagraph.h
+++ b/src/frontends/qt/GuiParagraph.h
@@ -60,12 +60,14 @@ private:
        bool hasLabelwidth() const;
        ///
        LyXAlignment alignPossible() const;
+       ///
+       void setButtons(bool const in_sync);
 
 private Q_SLOTS:
        ///
        void changed();
        ///
-       void on_synchronizedViewCB_toggled();
+       void on_synchronizedViewCB_stateChanged(int state);
        ///
        void on_linespacing_activated(int);
        /// Apply changes
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to