QPushButton * cancel_;
QPushButton * restore_;
QCheckBox * auto_apply_;
+ QPushButton * default_;
typedef QList<QWidget *> Widgets;
Widgets read_only_;
// refreshReadOnly(); This will enable all widgets in dialogs, no matter if
// they allowed to be enabled, so when you plan to
// reenable this call, read this before:
- // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg128222.html
+ // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg128222.html
refresh();
return ro;
}
bool const enabled = policy().buttonStatus(ButtonPolicy::AUTOAPPLY);
d->auto_apply_->setEnabled(enabled);
}
-
+ if (d->default_)
+ // Somewhere in the chain this can lose default status (#11417)
+ d->default_->setDefault(true);
}
}
-void ButtonController::setOK(QPushButton * obj)
+void ButtonController::setOK(QPushButton * obj, bool const default_button)
{
d->okay_ = obj;
+ if (default_button)
+ d->default_ = obj;
}
-void ButtonController::setApply(QPushButton * obj)
+void ButtonController::setApply(QPushButton * obj, bool const default_button)
{
d->apply_ = obj;
+ if (default_button)
+ d->default_ = obj;
}
}
-void ButtonController::setCancel(QPushButton * obj)
+void ButtonController::setCancel(QPushButton * obj, bool const default_button)
{
d->cancel_ = obj;
+ if (default_button)
+ d->default_ = obj;
}
-void ButtonController::setRestore(QPushButton * obj)
+void ButtonController::setRestore(QPushButton * obj, bool const default_button)
{
d->restore_ = obj;
+ if (default_button)
+ d->default_ = obj;
}
//
//@{
- /// Store pointers to these widgets.
- void setOK(QPushButton * obj);
- void setApply(QPushButton * obj);
- void setCancel(QPushButton * obj);
- void setRestore(QPushButton * obj);
+ /// Store pointers to these widgets. \param default_button determines
+ /// the default button of the dialog (bound to return). This is
+ /// OK by default.
+ void setOK(QPushButton * obj, bool const default_button = true);
+ void setApply(QPushButton * obj, bool const default_button = false);
+ void setCancel(QPushButton * obj, bool const default_button = false);
+ void setRestore(QPushButton * obj, bool const default_button = false);
void setAutoApply(QCheckBox * obj);
//@}
listingsGB->setEnabled(false);
break;
}
- //see this thread
- // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg118471.html
- //for the reason this is here.
- buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
}
// Activate OK/Apply buttons if the users inserts a new ref
// and we have a valid pre-setting.
bc().setValid(isValid() && new_inset);
- // Somewhere in the chain this can lose default status (#11417)
- buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
}
bool const update_widget =
(synchronizedCB->isChecked() || immediateApplyCB->isChecked());
updateView(update_widget);
-
+
// Somewhere in the chain this can lose default status (#11417)
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
}