add command to show/hide several constraints at once

This commit is contained in:
wmayer
2018-01-27 21:10:01 +01:00
parent 12968ed4a4
commit d1949f6e28
2 changed files with 26 additions and 0 deletions

View File

@@ -419,6 +419,12 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event)
QAction* driven = menu.addAction(tr("Toggle to/from reference"), this, SLOT(updateDrivingStatus()));
driven->setEnabled(isToggleDriving);
menu.addSeparator();
QAction* show = menu.addAction(tr("Show constraints"), this, SLOT(showConstraints()));
show->setEnabled(!items.isEmpty());
QAction* hide = menu.addAction(tr("Hide constraints"), this, SLOT(hideConstraints()));
hide->setEnabled(!items.isEmpty());
menu.addSeparator();
CONTEXT_ITEM("Sketcher_SelectElementsAssociatedWithConstraints","Select Elements","Sketcher_SelectElementsAssociatedWithConstraints",doSelectConstraints,true)
@@ -454,6 +460,24 @@ void ConstraintView::updateDrivingStatus()
}
}
void ConstraintView::showConstraints()
{
QList<QListWidgetItem *> items = selectedItems();
for (auto it : items) {
if (it->checkState() != Qt::Checked)
it->setCheckState(Qt::Checked);
}
}
void ConstraintView::hideConstraints()
{
QList<QListWidgetItem *> items = selectedItems();
for (auto it : items) {
if (it->checkState() != Qt::Unchecked)
it->setCheckState(Qt::Unchecked);
}
}
void ConstraintView::modifyCurrentItem()
{
/*emit*/itemActivated(currentItem());

View File

@@ -61,6 +61,8 @@ protected Q_SLOTS:
void doSelectConstraints();
void updateDrivingStatus();
void swapNamedOfSelectedItems();
void showConstraints();
void hideConstraints();
};
class TaskSketcherConstrains : public Gui::TaskView::TaskBox, public Gui::SelectionObserver