+ add convenience methods to PrefQuantitySpinBox class

This commit is contained in:
wmayer 2016-02-27 17:03:14 +01:00
parent 37e9c9732f
commit d8abb92ba5
2 changed files with 19 additions and 1 deletions

View File

@ -534,6 +534,16 @@ void PrefQuantitySpinBox::contextMenuEvent(QContextMenuEvent *event)
delete menu;
}
void PrefQuantitySpinBox::onSave()
{
pushToHistory();
}
void PrefQuantitySpinBox::onRestore()
{
setToLastUsedValue();
}
void PrefQuantitySpinBox::pushToHistory(const QString &valueq)
{
Q_D(PrefQuantitySpinBox);
@ -594,7 +604,11 @@ void PrefQuantitySpinBox::setToLastUsedValue()
void PrefQuantitySpinBox::setParamGrpPath(const QByteArray& path)
{
Q_D(PrefQuantitySpinBox);
d->handle = App::GetApplication().GetParameterGroupByPath(path);
QByteArray groupPath = path;
if (!groupPath.startsWith("User parameter:")) {
groupPath.prepend("User parameter:BaseApp/Preferences/");
}
d->handle = App::GetApplication().GetParameterGroupByPath(groupPath);
if (d->handle.isValid())
d->prefGrp = path;
}

View File

@ -296,6 +296,10 @@ public:
int historySize() const;
/// set the value of the history size property
void setHistorySize(int);
/// Convenience method as offered by PrefWidget. Does the same as pushToHistory().
void onSave();
/// Convenience method as offered by PrefWidget. Does the same as setToLastUsedValue().
void onRestore();
/** @name history and default management */
//@{