]> git.lyx.org Git - lyx.git/commitdiff
Properly disable Apply/OK in InsetParamsDialog (#11440)
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 7 Jan 2021 12:28:10 +0000 (13:28 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 7 Jan 2021 12:28:10 +0000 (13:28 +0100)
src/frontends/qt/InsetParamsDialog.cpp

index ebac60b721a5a40a0782a40c307dc77ac940bf6b..d2c0cae45d421270ea4ee6f01859f06e69f84321 100644 (file)
@@ -193,14 +193,16 @@ docstring InsetParamsDialog::checkWidgets(bool immediate)
                ? d->widget_->creationCode() : LFUN_INSET_MODIFY;
        bool const lfun_ok = lyx::getStatus(FuncRequest(code, argument)).enabled();
 
+       bool const changed_inset = ins && (ins != d->inset_ || d->changed_);
        buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!immediate && widget_ok
-                                                           && !read_only && valid_argument);
-       bool const can_be_restored = !immediate && !read_only
-                       && ins && (ins != d->inset_ || d->changed_);
+                                                           && !read_only && valid_argument
+                                                           && (!ins || changed_inset));
+       bool const can_be_restored = !immediate && !read_only && changed_inset;
        buttonBox->button(QDialogButtonBox::Reset)->setEnabled(can_be_restored);
-       buttonBox->button(QDialogButtonBox::Apply)->setEnabled(ins && !immediate
+       buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!immediate
                                                               && lfun_ok && widget_ok
-                                                              && !read_only && valid_argument);
+                                                              && !read_only && valid_argument
+                                                              && changed_inset);
        immediateApplyCB->setEnabled(ins && !read_only);
        // This seems to be the only way to access custom buttons
        QList<QAbstractButton*> buttons = buttonBox->buttons();