Skip to content

Commit

Permalink
add command to show/hide several constraints at once
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jan 27, 2018
1 parent 12968ed commit d1949f6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp
Expand Up @@ -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)

Expand Down Expand Up @@ -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());
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Sketcher/Gui/TaskSketcherConstrains.h
Expand Up @@ -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
Expand Down

0 comments on commit d1949f6

Please sign in to comment.