#include "support/gettext.h"
#include <QCheckBox>
+#include <QDialogButtonBox>
#include <QLineEdit>
#include <QPushButton>
#include <QSettings>
{
setupUi(this);
+ // fix height to minimum
+ setFixedHeight(sizeHint().height());
+
connect(alignDefaultRB, SIGNAL(clicked()), this, SLOT(changed()));
connect(alignJustRB, SIGNAL(clicked()), this, SLOT(changed()));
connect(alignLeftRB, SIGNAL(clicked()), this, SLOT(changed()));
// foreground and are hidden when the main window is not focused.
setWindowFlags(Qt::Tool);
synchronizedViewCB->setChecked(true);
- closePB->setText(qt_("&Cancel"));
#else
synchronizedViewCB->setChecked(false);
#endif
void GuiParagraph::on_synchronizedViewCB_toggled()
{
bool in_sync = synchronizedViewCB->isChecked();
- restorePB->setEnabled(!in_sync);
- applyPB->setEnabled(!in_sync);
- okPB->setEnabled(!in_sync);
+ buttonBox->button(QDialogButtonBox::Reset)->setEnabled(!in_sync);
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!in_sync);
+ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!in_sync);
if (!in_sync)
- closePB->setText(qt_("&Cancel"));
+ buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Cancel"));
else
- closePB->setText(qt_("&Close"));
+ buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Close"));
}
&& (linespacing->currentIndex() != 4
|| (!linespacingValue->text().endsWith(loc.decimalPoint())
&& linespacingValue->hasAcceptableInput())))
- on_applyPB_clicked();
-}
-
-
-void GuiParagraph::on_applyPB_clicked()
-{
- applyView();
-}
-
-
-void GuiParagraph::on_okPB_clicked()
-{
- applyView();
- hide();
-}
-
-
-void GuiParagraph::on_closePB_clicked()
-{
- hide();
+ applyView();
}
-void GuiParagraph::on_restorePB_clicked()
+void GuiParagraph::on_buttonBox_clicked(QAbstractButton * button)
{
- updateView();
+ switch (buttonBox->standardButton(button)) {
+ case QDialogButtonBox::Ok:
+ applyView();
+ hide();
+ break;
+ case QDialogButtonBox::Apply:
+ applyView();
+ break;
+ case QDialogButtonBox::Cancel:
+ hide();
+ break;
+ case QDialogButtonBox::Reset:
+ updateView();
+ break;
+ default:
+ break;
+ }
}
linespacingValue->setText(QString());
linespacingValue->setEnabled(false);
}
+ // Somewhere in the chain this can lose default status (#11417)
+ buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
}
linespacing->setEnabled(enable);
labelWidth->setEnabled(enable);
synchronizedViewCB->setEnabled(enable);
- applyPB->setEnabled(enable);
- restorePB->setEnabled(enable);
+ buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
+ buttonBox->button(QDialogButtonBox::Reset)->setEnabled(enable);
if (!enable)
synchronizedViewCB->setChecked(true);
RadioMap::const_iterator it = radioMap_.begin();
void GuiParagraph::dispatchParams()
{
- ostringstream data;
- params_.write(data);
- FuncRequest const fr(getLfun(), data.str());
+ ostringstream os;
+ params_.write(os);
+ FuncRequest const fr(getLfun(), os.str());
dispatch(fr);
}
}
-void GuiParagraph::saveSession() const
+void GuiParagraph::saveSession(QSettings & settings) const
{
- Dialog::saveSession();
- QSettings settings;
+ Dialog::saveSession(settings);
settings.setValue(sessionKey() + "/autoapply", synchronizedViewCB->isChecked());
}