Sketcher: Extend virtual space switching and update to constraints widget
This commit is contained in:
@@ -78,14 +78,15 @@ void ConstraintView::FUNC(){ \
|
||||
class ConstraintItem : public QListWidgetItem
|
||||
{
|
||||
public:
|
||||
ConstraintItem(const Sketcher::SketchObject * s, int ConstNbr)
|
||||
ConstraintItem(const Sketcher::SketchObject * s, ViewProviderSketch *sketchview, int ConstNbr)
|
||||
: QListWidgetItem(QString()),
|
||||
sketch(s),
|
||||
sketchView(sketchview),
|
||||
ConstraintNbr(ConstNbr)
|
||||
{
|
||||
this->setFlags(this->flags() | Qt::ItemIsEditable | Qt::ItemIsUserCheckable);
|
||||
|
||||
this->setCheckState(this->isInVirtualSpace()?Qt::Unchecked:Qt::Checked);
|
||||
updateVirtualSpaceStatus();
|
||||
}
|
||||
~ConstraintItem()
|
||||
{
|
||||
@@ -306,8 +307,13 @@ public:
|
||||
|
||||
return sketch->Constraints[ConstraintNbr]->isInVirtualSpace;
|
||||
}
|
||||
|
||||
void updateVirtualSpaceStatus() {
|
||||
this->setCheckState((this->isInVirtualSpace() != sketchView->getIsShownVirtualSpace())?Qt::Unchecked:Qt::Checked);
|
||||
}
|
||||
|
||||
const Sketcher::SketchObject * sketch;
|
||||
const ViewProviderSketch *sketchView;
|
||||
int ConstraintNbr;
|
||||
QVariant value;
|
||||
};
|
||||
@@ -743,7 +749,7 @@ void TaskSketcherConstrains::slotConstraintsChanged(void)
|
||||
const Sketcher::SketchObject * sketch = sketchView->getSketchObject();
|
||||
const std::vector< Sketcher::Constraint * > &vals = sketch->Constraints.getValues();
|
||||
|
||||
/* Update constraint number */
|
||||
/* Update constraint number and virtual space check status */
|
||||
for (int i = 0; i < ui->listWidgetConstraints->count(); ++i) {
|
||||
ConstraintItem * it = dynamic_cast<ConstraintItem*>(ui->listWidgetConstraints->item(i));
|
||||
|
||||
@@ -751,6 +757,10 @@ void TaskSketcherConstrains::slotConstraintsChanged(void)
|
||||
|
||||
it->ConstraintNbr = i;
|
||||
it->value = QVariant();
|
||||
|
||||
ui->listWidgetConstraints->blockSignals(true);
|
||||
it->updateVirtualSpaceStatus();
|
||||
ui->listWidgetConstraints->blockSignals(false);
|
||||
}
|
||||
|
||||
/* Remove entries, if any */
|
||||
@@ -759,7 +769,7 @@ void TaskSketcherConstrains::slotConstraintsChanged(void)
|
||||
|
||||
/* Add new entries, if any */
|
||||
for (std::size_t i = ui->listWidgetConstraints->count(); i < vals.size(); ++i)
|
||||
ui->listWidgetConstraints->addItem(new ConstraintItem(sketch, i));
|
||||
ui->listWidgetConstraints->addItem(new ConstraintItem(sketch, sketchView, i));
|
||||
|
||||
/* Update filtering */
|
||||
int Filter = ui->comboBoxFilter->currentIndex();
|
||||
|
||||
Reference in New Issue
Block a user