mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Maintain default status for all dialogs using ButtonController
Should fix rest of #11417
This commit is contained in:
parent
33344c6015
commit
e087722900
@ -114,6 +114,7 @@ public:
|
|||||||
QPushButton * cancel_;
|
QPushButton * cancel_;
|
||||||
QPushButton * restore_;
|
QPushButton * restore_;
|
||||||
QCheckBox * auto_apply_;
|
QCheckBox * auto_apply_;
|
||||||
|
QPushButton * default_;
|
||||||
|
|
||||||
typedef QList<QWidget *> Widgets;
|
typedef QList<QWidget *> Widgets;
|
||||||
Widgets read_only_;
|
Widgets read_only_;
|
||||||
@ -205,7 +206,7 @@ bool ButtonController::setReadOnly(bool ro)
|
|||||||
// refreshReadOnly(); This will enable all widgets in dialogs, no matter if
|
// refreshReadOnly(); This will enable all widgets in dialogs, no matter if
|
||||||
// they allowed to be enabled, so when you plan to
|
// they allowed to be enabled, so when you plan to
|
||||||
// reenable this call, read this before:
|
// 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();
|
refresh();
|
||||||
return ro;
|
return ro;
|
||||||
}
|
}
|
||||||
@ -243,7 +244,9 @@ void ButtonController::refresh() const
|
|||||||
bool const enabled = policy().buttonStatus(ButtonPolicy::AUTOAPPLY);
|
bool const enabled = policy().buttonStatus(ButtonPolicy::AUTOAPPLY);
|
||||||
d->auto_apply_->setEnabled(enabled);
|
d->auto_apply_->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
if (d->default_)
|
||||||
|
// Somewhere in the chain this can lose default status (#11417)
|
||||||
|
d->default_->setDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,15 +266,19 @@ void ButtonController::addCheckedLineEdit(QLineEdit * input, QWidget * label)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ButtonController::setOK(QPushButton * obj)
|
void ButtonController::setOK(QPushButton * obj, bool const default_button)
|
||||||
{
|
{
|
||||||
d->okay_ = obj;
|
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;
|
d->apply_ = obj;
|
||||||
|
if (default_button)
|
||||||
|
d->default_ = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -281,15 +288,19 @@ void ButtonController::setAutoApply(QCheckBox * obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ButtonController::setCancel(QPushButton * obj)
|
void ButtonController::setCancel(QPushButton * obj, bool const default_button)
|
||||||
{
|
{
|
||||||
d->cancel_ = obj;
|
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;
|
d->restore_ = obj;
|
||||||
|
if (default_button)
|
||||||
|
d->default_ = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,11 +92,13 @@ public:
|
|||||||
//
|
//
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/// Store pointers to these widgets.
|
/// Store pointers to these widgets. \param default_button determines
|
||||||
void setOK(QPushButton * obj);
|
/// the default button of the dialog (bound to return). This is
|
||||||
void setApply(QPushButton * obj);
|
/// OK by default.
|
||||||
void setCancel(QPushButton * obj);
|
void setOK(QPushButton * obj, bool const default_button = true);
|
||||||
void setRestore(QPushButton * obj);
|
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);
|
void setAutoApply(QCheckBox * obj);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
@ -154,10 +154,6 @@ void GuiInclude::typeChanged(int v)
|
|||||||
listingsGB->setEnabled(false);
|
listingsGB->setEnabled(false);
|
||||||
break;
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,8 +385,6 @@ void GuiRef::updateContents()
|
|||||||
// Activate OK/Apply buttons if the users inserts a new ref
|
// Activate OK/Apply buttons if the users inserts a new ref
|
||||||
// and we have a valid pre-setting.
|
// and we have a valid pre-setting.
|
||||||
bc().setValid(isValid() && new_inset);
|
bc().setValid(isValid() && new_inset);
|
||||||
// Somewhere in the chain this can lose default status (#11417)
|
|
||||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user