Added RestoreAllDefaultSettings action in Edit menu
git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@72 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
parent
f506c9e01f
commit
a1c6ec7509
@ -78,6 +78,7 @@ MainWindow::MainWindow(Camera * camera, QWidget * parent) :
|
||||
connect(ui_->actionSave_objects, SIGNAL(triggered()), this, SLOT(saveObjects()));
|
||||
connect(ui_->actionLoad_objects, SIGNAL(triggered()), this, SLOT(loadObjects()));
|
||||
connect(ui_->actionAbout, SIGNAL(triggered()), aboutDialog_ , SLOT(exec()));
|
||||
connect(ui_->actionRestore_all_default_settings, SIGNAL(triggered()), ui_->toolBox, SLOT(resetAllPages()));
|
||||
|
||||
QTimer::singleShot(10, this, SLOT(startProcessing()));
|
||||
}
|
||||
|
||||
@ -57,6 +57,43 @@ void ParametersToolBox::resetCurrentPage()
|
||||
}
|
||||
}
|
||||
|
||||
void ParametersToolBox::resetAllPages()
|
||||
{
|
||||
for(int i=0; i< this->count(); ++i)
|
||||
{
|
||||
const QObjectList & children = this->widget(i)->children();
|
||||
for(int j=0; j<children.size();++j)
|
||||
{
|
||||
QString key = children.at(j)->objectName();
|
||||
// ignore only the nextObjID setting, to avoid problem with saved objects
|
||||
if(key.compare(Settings::kGeneral_nextObjID()) != 0)
|
||||
{
|
||||
QVariant value = Settings::getDefaultParameters().value(key, QVariant());
|
||||
if(value.isValid())
|
||||
{
|
||||
if(qobject_cast<QComboBox*>(children.at(j)))
|
||||
{
|
||||
((QComboBox*)children.at(j))->setCurrentIndex(value.toString().split(':').first().toInt());
|
||||
}
|
||||
else if(qobject_cast<QSpinBox*>(children.at(j)))
|
||||
{
|
||||
((QSpinBox*)children.at(j))->setValue(value.toInt());
|
||||
}
|
||||
else if(qobject_cast<QDoubleSpinBox*>(children.at(j)))
|
||||
{
|
||||
((QDoubleSpinBox*)children.at(j))->setValue(value.toDouble());
|
||||
}
|
||||
else if(qobject_cast<QCheckBox*>(children.at(j)))
|
||||
{
|
||||
((QCheckBox*)children.at(j))->setChecked(value.toBool());
|
||||
}
|
||||
Settings::setParameter(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParametersToolBox::setupUi()
|
||||
{
|
||||
QWidget * currentItem = 0;
|
||||
|
||||
@ -34,6 +34,7 @@ private slots:
|
||||
void changeParameter(const QString & value);
|
||||
void changeParameter(const int & value);
|
||||
void resetCurrentPage();
|
||||
void resetAllPages();
|
||||
};
|
||||
|
||||
#endif /* PARAMETERSTOOLBOX_H_ */
|
||||
|
||||
@ -150,6 +150,8 @@
|
||||
<addaction name="actionAdd_object"/>
|
||||
<addaction name="actionStart_camera"/>
|
||||
<addaction name="actionStop_camera"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRestore_all_default_settings"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
@ -467,6 +469,11 @@
|
||||
<string>About...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRestore_all_default_settings">
|
||||
<property name="text">
|
||||
<string>Restore all default settings</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user