0001105: disable grid in sketcher

This commit is contained in:
wmayer 2013-07-14 18:14:18 +02:00
parent 56b9694427
commit b7992ed76f
3 changed files with 31 additions and 1 deletions

View File

@ -53,6 +53,10 @@ TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView)
this->groupLayout()->addWidget(proxy); this->groupLayout()->addWidget(proxy);
// connecting the needed signals // connecting the needed signals
QObject::connect(
ui->checkBoxShowGrid, SIGNAL(toggled(bool)),
this , SLOT(toggleGridView(bool))
);
QObject::connect( QObject::connect(
ui->checkBoxGridSnap, SIGNAL(stateChanged(int)), ui->checkBoxGridSnap, SIGNAL(stateChanged(int)),
this , SLOT (toggleGridSnap(int)) this , SLOT (toggleGridSnap(int))
@ -69,14 +73,29 @@ TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView)
); );
Gui::Selection().Attach(this); Gui::Selection().Attach(this);
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
ui->checkBoxShowGrid->setChecked(hGrp->GetBool("ShowGrid", true));
} }
TaskSketcherGeneral::~TaskSketcherGeneral() TaskSketcherGeneral::~TaskSketcherGeneral()
{ {
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
hGrp->SetBool("ShowGrid", ui->checkBoxShowGrid->isChecked());
delete ui; delete ui;
Gui::Selection().Detach(this); Gui::Selection().Detach(this);
} }
void TaskSketcherGeneral::toggleGridView(bool on)
{
ui->label->setEnabled(on);
ui->comboBoxGridSize->setEnabled(on);
ui->checkBoxGridSnap->setEnabled(on);
sketchView->ShowGrid.setValue(on);
}
void TaskSketcherGeneral::setGridSize(const QString& val) void TaskSketcherGeneral::setGridSize(const QString& val)
{ {
float gridSize = (float) Base::UnitsApi::translateUnit(val); float gridSize = (float) Base::UnitsApi::translateUnit(val);

View File

@ -52,6 +52,7 @@ Q_SIGNALS:
void setGridSnap(int Type); void setGridSnap(int Type);
public Q_SLOTS: public Q_SLOTS:
void toggleGridView(bool on);
void setGridSize(const QString& val); void setGridSize(const QString& val);
void toggleGridSnap(int state); void toggleGridSnap(int state);
void toggleAutoconstraints(int state); void toggleAutoconstraints(int state);

View File

@ -7,13 +7,23 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>153</width> <width>153</width>
<height>88</height> <height>112</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxShowGrid">
<property name="text">
<string>Show grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>