Merge branch 'master' into sketcherMoveColorsToPrefs

This commit is contained in:
Chris Hennes
2021-10-11 12:31:08 -05:00
committed by GitHub
129 changed files with 7990 additions and 3614 deletions

View File

@@ -47,6 +47,7 @@ set(SketcherGui_UIC_SRCS
SketchRectangularArrayDialog.ui
SketcherRegularPolygonDialog.ui
ConstraintMultiFilterDialog.ui
ConstraintSettingsDialog.ui
)
if(BUILD_QT5)
@@ -120,6 +121,8 @@ SET(SketcherGui_SRCS
SketcherRegularPolygonDialog.cpp
ConstraintMultiFilterDialog.h
ConstraintMultiFilterDialog.cpp
ConstraintSettingsDialog.h
ConstraintSettingsDialog.cpp
TaskDlgEditSketch.cpp
TaskDlgEditSketch.h
ViewProviderPython.cpp

View File

@@ -337,6 +337,7 @@ void CmdSketcherSelectConstraints::activated(int iMsg)
getSelection().clearSelection();
std::vector<std::string> constraintSubNames;
// go through the selected subelements
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
// only handle edges
@@ -349,13 +350,15 @@ void CmdSketcherSelectConstraints::activated(int iMsg)
it != vals.end(); ++it,++i)
{
if ((*it)->First == GeoId || (*it)->Second == GeoId || (*it)->Third == GeoId) {
Gui::Selection().addSelection(doc_name.c_str(),
obj_name.c_str(),
Sketcher::PropertyConstraintList::getConstraintName(i).c_str());
constraintSubNames.push_back(Sketcher::PropertyConstraintList::getConstraintName(i));
}
}
}
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool CmdSketcherSelectConstraints::isActive(void)
@@ -533,17 +536,20 @@ void CmdSketcherSelectRedundantConstraints::activated(int iMsg)
getSelection().clearSelection();
// push the constraints
std::vector<std::string> constraintSubNames;
int i = 0;
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();it != vals.end(); ++it,++i) {
for(std::vector< int >::const_iterator itc= solverredundant.begin();itc != solverredundant.end(); ++itc) {
if ((*itc) - 1 == i) {
Gui::Selection().addSelection(doc_name.c_str(),
obj_name.c_str(),
Sketcher::PropertyConstraintList::getConstraintName(i).c_str());
constraintSubNames.push_back(Sketcher::PropertyConstraintList::getConstraintName(i));
break;
}
}
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool CmdSketcherSelectRedundantConstraints::isActive(void)
@@ -587,17 +593,19 @@ void CmdSketcherSelectMalformedConstraints::activated(int iMsg)
getSelection().clearSelection();
// push the constraints
std::vector<std::string> constraintSubNames;
int i = 0;
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();it != vals.end(); ++it,++i) {
for(std::vector< int >::const_iterator itc= solvermalformed.begin();itc != solvermalformed.end(); ++itc) {
if ((*itc) - 1 == i) {
Gui::Selection().addSelection(doc_name.c_str(),
obj_name.c_str(),
Sketcher::PropertyConstraintList::getConstraintName(i).c_str());
constraintSubNames.push_back(Sketcher::PropertyConstraintList::getConstraintName(i));
break;
}
}
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool CmdSketcherSelectMalformedConstraints::isActive(void)
@@ -641,17 +649,19 @@ void CmdSketcherSelectPartiallyRedundantConstraints::activated(int iMsg)
getSelection().clearSelection();
// push the constraints
std::vector<std::string> constraintSubNames;
int i = 0;
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();it != vals.end(); ++it,++i) {
for(std::vector< int >::const_iterator itc= solverpartiallyredundant.begin();itc != solverpartiallyredundant.end(); ++itc) {
if ((*itc) - 1 == i) {
Gui::Selection().addSelection(doc_name.c_str(),
obj_name.c_str(),
Sketcher::PropertyConstraintList::getConstraintName(i).c_str());
constraintSubNames.push_back(Sketcher::PropertyConstraintList::getConstraintName(i));
break;
}
}
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool CmdSketcherSelectPartiallyRedundantConstraints::isActive(void)
@@ -693,17 +703,19 @@ void CmdSketcherSelectConflictingConstraints::activated(int iMsg)
getSelection().clearSelection();
// push the constraints
std::vector<std::string> constraintSubNames;
int i = 0;
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();it != vals.end(); ++it,++i) {
for (std::vector< int >::const_iterator itc= solverconflicting.begin();itc != solverconflicting.end(); ++itc) {
if ((*itc) - 1 == i) {
Gui::Selection().addSelection(doc_name.c_str(),
obj_name.c_str(),
Sketcher::PropertyConstraintList::getConstraintName(i).c_str());
constraintSubNames.push_back(Sketcher::PropertyConstraintList::getConstraintName(i));
break;
}
}
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool CmdSketcherSelectConflictingConstraints::isActive(void)
@@ -747,8 +759,7 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
std::string obj_name = Obj->getNameInDocument();
std::stringstream ss;
int selected = 0;
std::vector<std::string> elementSubNames;
// go through the selected subelements
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
// only handle constraints
@@ -772,9 +783,7 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
ss << "Vertex" << vertex + 1;
break;
}
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
selected++;
elementSubNames.push_back(ss.str());
}
if(vals[ConstrId]->Second!=Constraint::GeoUndef){
@@ -794,8 +803,7 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
break;
}
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
selected++;
elementSubNames.push_back(ss.str());
}
if(vals[ConstrId]->Third!=Constraint::GeoUndef){
@@ -815,17 +823,20 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
break;
}
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
selected++;
elementSubNames.push_back(ss.str());
}
}
}
}
if (selected == 0) {
if (elementSubNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No constraint selected"),
QObject::tr("At least one constraint must be selected"));
}
else {
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), elementSubNames);
}
}
bool CmdSketcherSelectElementsAssociatedWithConstraints::isActive(void)
@@ -866,22 +877,24 @@ void CmdSketcherSelectElementsWithDoFs::activated(int iMsg)
auto geos = Obj->getInternalGeometry();
auto testselectvertex = [&Obj, &ss, &doc_name, &obj_name](int geoId, PointPos pos) {
std::vector<std::string> elementSubNames;
auto testselectvertex = [&Obj, &ss, &elementSubNames](int geoId, PointPos pos) {
ss.str(std::string());
int vertex = Obj->getVertexIndexGeoPos(geoId, pos);
if (vertex > -1) {
ss << "Vertex" << vertex + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
}
};
auto testselectedge = [&ss, &doc_name, &obj_name](int geoId) {
auto testselectedge = [&ss, &elementSubNames](int geoId) {
ss.str(std::string());
ss << "Edge" << geoId + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
};
int geoid = 0;
@@ -911,6 +924,10 @@ void CmdSketcherSelectElementsWithDoFs::activated(int iMsg)
geoid++;
}
if (!elementSubNames.empty()) {
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), elementSubNames);
}
}
bool CmdSketcherSelectElementsWithDoFs::isActive(void)

View File

@@ -36,19 +36,19 @@ namespace ConstraintFilter {
Datums = 2,
Named = 3,
NonDriving = 4,
Horizontal = 5,
Vertical = 6,
Coincident = 7,
PointOnObject = 8,
Coincident = 5,
PointOnObject = 6,
Vertical = 7,
Horizontal = 8,
Parallel = 9,
Perpendicular = 10,
Tangent = 11,
Equality = 12,
Symmetric = 13,
Block = 14,
Distance = 15,
HorizontalDistance = 16,
VerticalDistance = 17,
HorizontalDistance = 15,
VerticalDistance = 16,
Distance = 17,
Radius = 18,
Weight = 19,
Diameter = 20,
@@ -60,6 +60,8 @@ namespace ConstraintFilter {
enum SpecialFilterValue {
Multiple = 24,
Selection = 25,
AssociatedConstraints = 26,
NumSpecialFilterValue
};
@@ -73,22 +75,22 @@ namespace ConstraintFilter {
1 << FilterValue::Geometric | 1 << FilterValue::Horizontal | 1 << FilterValue::Vertical | 1 << FilterValue::Coincident |
1 << FilterValue::PointOnObject | 1 << FilterValue::Parallel | 1 << FilterValue::Perpendicular | 1 << FilterValue::Tangent |
1 << FilterValue::Equality | 1 << FilterValue::Symmetric | 1 << FilterValue::Block | 1 << FilterValue::InternalAlignment, // Geometric = All others not being datums (1)
1 << FilterValue::Datums | 1 << FilterValue::NonDriving | 1 << FilterValue::Distance | 1 << FilterValue::HorizontalDistance | 1 << FilterValue::VerticalDistance | 1 << FilterValue::Radius | 1 << FilterValue::Weight | 1 << FilterValue::Diameter | 1 << FilterValue::Angle | 1 << FilterValue::SnellsLaw, // Datum = all others not being geometric (2)
1 << FilterValue::Datums | 1 << FilterValue::Distance | 1 << FilterValue::HorizontalDistance | 1 << FilterValue::VerticalDistance | 1 << FilterValue::Radius | 1 << FilterValue::Weight | 1 << FilterValue::Diameter | 1 << FilterValue::Angle | 1 << FilterValue::SnellsLaw, // Datum = all others not being geometric (2)
1 << FilterValue::Named, // Named = Just this (3)
1 << FilterValue::NonDriving, // NonDriving = Just this (4)
1 << FilterValue::Horizontal, // Horizontal = Just this (5)
1 << FilterValue::Vertical, // Vertical = Just this (6)
1 << FilterValue::Coincident, // Coincident = Just this (7)
1 << FilterValue::PointOnObject, // PointOnObject = Just this (8)
1 << FilterValue::Coincident, // Coincident = Just this (5)
1 << FilterValue::PointOnObject, // PointOnObject = Just this (6)
1 << FilterValue::Vertical, // Vertical = Just this (7)
1 << FilterValue::Horizontal, // Horizontal = Just this (8)
1 << FilterValue::Parallel, // Parallel = Just this (9)
1 << FilterValue::Perpendicular, // Perpendicular = Just this (10)
1 << FilterValue::Tangent, // Tangent = Just this (11)
1 << FilterValue::Equality, // Equality = Just this (12)
1 << FilterValue::Symmetric, // Symmetric = Just this (13)
1 << FilterValue::Block, // Block = Just this (14)
1 << FilterValue::Distance, // Distance = Just this (15)
1 << FilterValue::HorizontalDistance, // HorizontalDistance = Just this (16)
1 << FilterValue::VerticalDistance, // VerticalDistance = Just this (17)
1 << FilterValue::HorizontalDistance, // HorizontalDistance = Just this (15)
1 << FilterValue::VerticalDistance, // VerticalDistance = Just this (16)
1 << FilterValue::Distance, // Distance = Just this (17)
1 << FilterValue::Radius, // Radius = Just this (18)
1 << FilterValue::Weight, // Weight = Just this (19)
1 << FilterValue::Diameter, // Diameter = Just this (20)

View File

@@ -93,15 +93,43 @@ void ConstraintMultiFilterDialog::on_listMultiFilter_itemChanged(QListWidgetItem
{
int filterindex = ui->listMultiFilter->row(item);
auto aggregate = filterAggregates[filterindex];
auto itemAggregate = filterAggregates[filterindex];
ui->listMultiFilter->blockSignals(true);
if(item->checkState() == Qt::Checked) {
for(int i = 0; i < ui->listMultiFilter->count(); i++) {
if(aggregate[i])
ui->listMultiFilter->item(i)->setCheckState(Qt::Checked);
for(int i = 0; i < ui->listMultiFilter->count(); i++) {
// any filter comprised on the filter of the activated item, gets the same check state
if(itemAggregate[i])
ui->listMultiFilter->item(i)->setCheckState(item->checkState());
// if unchecking, in addition uncheck any group comprising the unchecked item
if(item->checkState() == Qt::Unchecked) {
if(filterAggregates[i][filterindex])
ui->listMultiFilter->item(i)->setCheckState(Qt::Unchecked);
}
}
// Now that all filters are correctly updated to match dependencies,
// if checking, in addition check any group comprising all items that are checked, and check it if all checked.
if(item->checkState() == Qt::Checked) {
for(int i = 0; i < ui->listMultiFilter->count(); i++) {
if(filterAggregates[i][filterindex]) { // only for groups comprising the changed filter
bool mustBeChecked = true;
for(int j = 0; j < FilterValue::NumFilterValue; j++) {
if (i == j)
continue;
if (filterAggregates[i][j]) // if it is in group
mustBeChecked = mustBeChecked && ui->listMultiFilter->item(j)->checkState() == Qt::Checked;
}
if(mustBeChecked)
ui->listMultiFilter->item(i)->setCheckState(Qt::Checked);
}
}
}
ui->listMultiFilter->blockSignals(false);
}

View File

@@ -9,22 +9,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>325</width>
<width>274</width>
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>700</height>
</size>
</property>
<property name="windowTitle">
<string>Multiple filter selection</string>
</property>
@@ -39,16 +33,13 @@
<item>
<widget class="QListWidget" name="listMultiFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>500</height>
</size>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
@@ -78,17 +69,7 @@
</item>
<item>
<property name="text">
<string>Non-Driving</string>
</property>
</item>
<item>
<property name="text">
<string>Horizontal</string>
</property>
</item>
<item>
<property name="text">
<string>Vertical</string>
<string>Reference</string>
</property>
</item>
<item>
@@ -101,6 +82,16 @@
<string>Point on Object</string>
</property>
</item>
<item>
<property name="text">
<string>Vertical</string>
</property>
</item>
<item>
<property name="text">
<string>Horizontal</string>
</property>
</item>
<item>
<property name="text">
<string>Parallel</string>
@@ -131,11 +122,6 @@
<string>Block</string>
</property>
</item>
<item>
<property name="text">
<string>Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Horizontal Distance</string>
@@ -146,6 +132,11 @@
<string>Vertical Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Radius</string>
@@ -217,19 +208,6 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">

View File

@@ -0,0 +1,136 @@
/***************************************************************************
* Copyright (c) 2021 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QPixmap>
# include <QDialog>
#endif
#include <Gui/BitmapFactory.h>
#include <Gui/MainWindow.h>
#include <Base/Tools.h>
#include <Base/UnitsApi.h>
#include <Gui/PrefWidgets.h>
#include "ui_ConstraintSettingsDialog.h"
#include "ConstraintSettingsDialog.h"
using namespace SketcherGui;
ConstraintSettingsDialog::ConstraintSettingsDialog(void)
: QDialog(Gui::getMainWindow()), ui(new Ui_ConstraintSettingsDialog)
{
ui->setupUi(this);
{ // in case any signal is connected before this
QSignalBlocker block(this);
loadSettings();
snapshotInitialSettings();
}
QObject::connect(
ui->filterInternalAlignment, SIGNAL(stateChanged(int)),
this , SLOT (on_filterInternalAlignment_stateChanged(int))
);
QObject::connect(
ui->extendedInformation, SIGNAL(stateChanged(int)),
this , SLOT (on_extendedInformation_stateChanged(int))
);
QObject::connect(
ui->visualisationTrackingFilter, SIGNAL(stateChanged(int)),
this , SLOT (on_visualisationTrackingFilter_stateChanged(int))
);
}
void ConstraintSettingsDialog::saveSettings()
{
ui->extendedInformation->onSave();
ui->filterInternalAlignment->onSave();
ui->visualisationTrackingFilter->onSave();
}
void ConstraintSettingsDialog::loadSettings()
{
ui->extendedInformation->onRestore();
ui->filterInternalAlignment->onRestore();
ui->visualisationTrackingFilter->onRestore();
}
void ConstraintSettingsDialog::snapshotInitialSettings()
{
auto isChecked = [] (auto prefwidget) {return prefwidget->checkState() == Qt::Checked;};
extendedInformation = isChecked(ui->extendedInformation);
filterInternalAlignment = isChecked(ui->filterInternalAlignment);
visualisationTrackingFilter = isChecked(ui->visualisationTrackingFilter);
}
void ConstraintSettingsDialog::restoreInitialSettings()
{
auto restoreCheck = [] (auto prefwidget, bool initialvalue) {
if( initialvalue != (prefwidget->checkState() == Qt::Checked)) // if the state really changed
initialvalue ? prefwidget->setCheckState(Qt::Checked) : prefwidget->setCheckState(Qt::Unchecked);
};
restoreCheck(ui->extendedInformation, extendedInformation);
restoreCheck(ui->filterInternalAlignment, filterInternalAlignment);
restoreCheck(ui->visualisationTrackingFilter, visualisationTrackingFilter);
}
void ConstraintSettingsDialog::accept()
{
saveSettings();
QDialog::accept();
}
void ConstraintSettingsDialog::reject()
{
restoreInitialSettings();
saveSettings();
QDialog::reject();
}
void ConstraintSettingsDialog::on_filterInternalAlignment_stateChanged(int state)
{
ui->filterInternalAlignment->onSave();
Q_EMIT emit_filterInternalAlignment_stateChanged(state);
}
void ConstraintSettingsDialog::on_visualisationTrackingFilter_stateChanged(int state)
{
ui->visualisationTrackingFilter->onSave();
Q_EMIT emit_visualisationTrackingFilter_stateChanged(state);
}
void ConstraintSettingsDialog::on_extendedInformation_stateChanged(int state)
{
ui->extendedInformation->onSave();
Q_EMIT emit_extendedInformation_stateChanged(state);
}
ConstraintSettingsDialog::~ConstraintSettingsDialog()
{
}
#include "moc_ConstraintSettingsDialog.cpp"

View File

@@ -0,0 +1,70 @@
/***************************************************************************
* Copyright (c) 2021 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef SKETCHERGUI_ConstraintSettingsDialog_H
#define SKETCHERGUI_ConstraintSettingsDialog_H
#include <QDialog>
#include "ConstraintFilters.h"
namespace SketcherGui {
using namespace ConstraintFilter;
class Ui_ConstraintSettingsDialog;
class ConstraintSettingsDialog : public QDialog
{
Q_OBJECT
public:
ConstraintSettingsDialog(void);
~ConstraintSettingsDialog();
Q_SIGNALS:
void emit_filterInternalAlignment_stateChanged(int);
void emit_extendedInformation_stateChanged(int);
void emit_visualisationTrackingFilter_stateChanged(int);
public Q_SLOTS:
void accept();
void reject();
void on_filterInternalAlignment_stateChanged(int state);
void on_extendedInformation_stateChanged(int state);
void on_visualisationTrackingFilter_stateChanged(int state);
private:
void saveSettings();
void loadSettings();
void snapshotInitialSettings();
void restoreInitialSettings();
private:
std::unique_ptr<Ui_ConstraintSettingsDialog> ui;
bool extendedInformation;
bool filterInternalAlignment;
bool visualisationTrackingFilter;
};
}
#endif // SKETCHERGUI_ConstraintSettingsDialog_H

View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SketcherGui::ConstraintSettingsDialog</class>
<widget class="QWidget" name="SketcherGui::ConstraintSettingsDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>215</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Constraint widget settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>List control</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="filterInternalAlignment">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Internal alignments will be hidden</string>
</property>
<property name="text">
<string>Hide internal alignment</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>HideInternalAlignment</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="extendedInformation">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Extended information will be added to the list</string>
</property>
<property name="text">
<string>Extended information</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ExtendedConstraintInformation</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>3D view control</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="visualisationTrackingFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Constraint visualisation tracks filter selection so that filtered out constraints are hidden</string>
</property>
<property name="text">
<string>Show only filtered constraints</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>VisualisationTrackingFilter</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SketcherGui::ConstraintSettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SketcherGui::ConstraintSettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -238,6 +238,9 @@
<file>icons/tools/Sketcher_SelectVerticalAxis.svg</file>
<file>icons/tools/Sketcher_Symmetry.svg</file>
</qresource>
<qresource>
<file>icons/dialogs/Sketcher_Settings.svg</file>
</qresource>
<qresource>
<file>translations/Sketcher_af.qm</file>
<file>translations/Sketcher_ar.qm</file>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -58,6 +58,7 @@
#include <Gui/PrefWidgets.h>
#include "ConstraintMultiFilterDialog.h"
#include "ConstraintSettingsDialog.h"
using namespace SketcherGui;
using namespace Gui::TaskView;
@@ -453,13 +454,18 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event)
// Sync the FreeCAD selection with the selection in the ConstraintView widget
if (didRelease) {
Gui::Selection().clearSelection();
std::string doc_name = static_cast<ConstraintItem*>(item)->sketchView->getSketchObject()->getDocument()->getName();
std::string obj_name = static_cast<ConstraintItem*>(item)->sketchView->getSketchObject()->getNameInDocument();
std::vector<std::string> constraintSubNames;
for (auto&& it : items) {
auto ci = static_cast<ConstraintItem*>(it);
std::string constraint_name = Sketcher::PropertyConstraintList::getConstraintName(ci->ConstraintNbr);
std::string doc_name = ci->sketchView->getSketchObject()->getDocument()->getName();
std::string obj_name = ci->sketchView->getSketchObject()->getNameInDocument();
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), constraint_name.c_str());
constraintSubNames.push_back(constraint_name.c_str());
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
}
bool isQuantity = false;
@@ -637,6 +643,8 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView) :
ui->listWidgetConstraints->setEditTriggers(QListWidget::EditKeyPressed);
//QMetaObject::connectSlotsByName(this);
createVisibilityButtonActions();
// connecting the needed signals
QObject::connect(
ui->comboBoxFilter, SIGNAL(currentIndexChanged(int)),
@@ -666,14 +674,6 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView) :
ui->listWidgetConstraints, SIGNAL(onUpdateActiveStatus(QListWidgetItem *, bool)),
this , SLOT (on_listWidgetConstraints_updateActiveStatus(QListWidgetItem *, bool))
);
QObject::connect(
ui->filterInternalAlignment, SIGNAL(stateChanged(int)),
this , SLOT (on_filterInternalAlignment_stateChanged(int))
);
QObject::connect(
ui->extendedInformation, SIGNAL(stateChanged(int)),
this , SLOT (on_extendedInformation_stateChanged(int))
);
QObject::connect(
ui->showAllButton, SIGNAL(clicked(bool)),
this , SLOT (on_showAllButton_clicked(bool))
@@ -690,23 +690,29 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView) :
ui->listWidgetConstraints, SIGNAL(emitShowSelection3DVisibility()),
this , SLOT (on_listWidgetConstraints_emitShowSelection3DVisibility())
);
QObject::connect(
ui->visualisationTrackingFilter, SIGNAL(stateChanged(int)),
this , SLOT (on_visualisationTrackingFilter_stateChanged(int))
);
QObject::connect(
ui->multipleFilterButton, SIGNAL(clicked(bool)),
this , SLOT (on_multipleFilterButton_clicked(bool))
);
QObject::connect(
ui->settingsDialogButton, SIGNAL(clicked(bool)),
this , SLOT (on_settingsDialogButton_clicked(bool))
);
QObject::connect(
ui->visibilityButton, SIGNAL(clicked(bool)),
this , SLOT (on_visibilityButton_clicked(bool))
);
QObject::connect(
ui->visibilityButton->actions()[0], SIGNAL(changed()),
this , SLOT (on_visibilityButton_trackingaction_changed())
);
connectionConstraintsChanged = sketchView->signalConstraintsChanged.connect(
boost::bind(&SketcherGui::TaskSketcherConstrains::slotConstraintsChanged, this));
this->groupLayout()->addWidget(proxy);
this->ui->filterInternalAlignment->onRestore();
this->ui->extendedInformation->onRestore();
multiFilterStatus.set(); // Match 'All' selection, all bits set.
slotConstraintsChanged();
@@ -714,24 +720,84 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView) :
TaskSketcherConstrains::~TaskSketcherConstrains()
{
this->ui->filterInternalAlignment->onSave();
this->ui->extendedInformation->onSave();
connectionConstraintsChanged.disconnect();
}
void TaskSketcherConstrains::updateMultiFilter()
void TaskSketcherConstrains::createVisibilityButtonActions()
{
int filterindex = ui->comboBoxFilter->currentIndex();
QAction* action = new QAction(QString::fromLatin1("Show only filtered Constraints"),this);
multiFilterStatus.reset();
action->setCheckable(true);
multiFilterStatus.set(filterindex);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool visibilityTracksFilter = hGrp->GetBool("VisualisationTrackingFilter",false);
{
QSignalBlocker block(this);
action->setChecked(visibilityTracksFilter);
}
ui->visibilityButton->addAction(action);
}
void TaskSketcherConstrains::updateSelectionFilter()
{
// Snapshot current selection
auto items = ui->listWidgetConstraints->selectedItems();
selectionFilter.clear();
for(const auto & item : items)
selectionFilter.push_back(static_cast<ConstraintItem*>(item)->ConstraintNbr);
}
void TaskSketcherConstrains::updateAssociatedConstraintsFilter()
{
associatedConstraintsFilter.clear();
assert(sketchView);
std::vector<Gui::SelectionObject> selection;
selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
return;
}
// get the needed lists and objects
const std::vector<std::string> &SubNames = selection[0].getSubNames();
const Sketcher::SketchObject * Obj = sketchView->getSketchObject();
const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues();
std::vector<std::string> constraintSubNames;
// go through the selected subelements
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
// only handle edges
if (it->size() > 4 && it->substr(0,4) == "Edge") {
int GeoId = std::atoi(it->substr(4,4000).c_str()) - 1;
// push all the constraints
int i = 0;
for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin();
it != vals.end(); ++it,++i)
{
if ((*it)->First == GeoId || (*it)->Second == GeoId || (*it)->Third == GeoId) {
associatedConstraintsFilter.push_back(i);
}
}
}
}
updateList();
}
void TaskSketcherConstrains::updateList()
{
// enforce constraint visibility
bool visibilityTracksFilter = ui->visualisationTrackingFilter->isChecked();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool visibilityTracksFilter = hGrp->GetBool("VisualisationTrackingFilter",false);
if(visibilityTracksFilter)
change3DViewVisibilityToTrackFilter(); // it will call slotConstraintChanged via update mechanism
@@ -759,6 +825,26 @@ void TaskSketcherConstrains::on_multipleFilterButton_clicked(bool)
}
}
void TaskSketcherConstrains::on_settingsDialogButton_clicked(bool)
{
ConstraintSettingsDialog cs;
QObject::connect(
&cs, SIGNAL(emit_filterInternalAlignment_stateChanged(int)),
this , SLOT (on_filterInternalAlignment_stateChanged(int))
);
QObject::connect(
&cs, SIGNAL(emit_extendedInformation_stateChanged(int)),
this , SLOT (on_extendedInformation_stateChanged(int))
);
QObject::connect(
&cs, SIGNAL(emit_visualisationTrackingFilter_stateChanged(int)),
this , SLOT (on_visualisationTrackingFilter_stateChanged(int))
);
cs.exec(); // The dialog reacted on any change, so the result of running the dialog is already reflected on return.
}
void TaskSketcherConstrains::changeFilteredVisibility(bool show, ActionTarget target)
{
assert(sketchView);
@@ -854,11 +940,25 @@ void TaskSketcherConstrains::on_listWidgetConstraints_emitShowSelection3DVisibil
void TaskSketcherConstrains::onSelectionChanged(const Gui::SelectionChanges& msg)
{
assert(sketchView);
std::string temp;
if (msg.Type == Gui::SelectionChanges::ClrSelection) {
ui->listWidgetConstraints->blockSignals(true);
ui->listWidgetConstraints->clearSelection ();
ui->listWidgetConstraints->clearSelection();
ui->listWidgetConstraints->blockSignals(false);
if(isFilter(ConstraintFilter::SpecialFilterValue::Selection)) {
updateSelectionFilter();
bool block = this->blockConnection(true); // avoid to be notified by itself
updateList();
this->blockConnection(block);
}
else if (isFilter(ConstraintFilter::SpecialFilterValue::AssociatedConstraints)) {
associatedConstraintsFilter.clear();
updateList();
}
}
else if (msg.Type == Gui::SelectionChanges::AddSelection ||
msg.Type == Gui::SelectionChanges::RmvSelection) {
@@ -870,7 +970,7 @@ void TaskSketcherConstrains::onSelectionChanged(const Gui::SelectionChanges& msg
QRegExp rx(QString::fromLatin1("^Constraint(\\d+)$"));
QString expr = QString::fromLatin1(msg.pSubName);
int pos = expr.indexOf(rx);
if (pos > -1) {
if (pos > -1) { // is a constraint
bool ok;
int ConstrId = rx.cap(1).toInt(&ok) - 1;
if (ok) {
@@ -885,6 +985,25 @@ void TaskSketcherConstrains::onSelectionChanged(const Gui::SelectionChanges& msg
break;
}
}
if(isFilter(ConstraintFilter::SpecialFilterValue::Selection)) {
updateSelectionFilter();
bool block = this->blockConnection(true); // avoid to be notified by itself
updateList();
this->blockConnection(block);
}
}
}
else if(isFilter(ConstraintFilter::SpecialFilterValue::AssociatedConstraints)) { // is NOT a constraint
int geoid = Sketcher::Constraint::GeoUndef;
Sketcher::PointPos pointpos = Sketcher::none;
getSelectionGeoId(expr, geoid, pointpos);
if(geoid != Sketcher::Constraint::GeoUndef && pointpos == Sketcher::none){
// It is not possible to update on single addition/removal of a geometric element,
// as one removal may imply removing a constraint that should be added by a different element
// that is still selected. The necessary checks outweight a full rebuild of the filter.
updateAssociatedConstraintsFilter();
}
}
}
@@ -895,9 +1014,47 @@ void TaskSketcherConstrains::onSelectionChanged(const Gui::SelectionChanges& msg
}
}
void TaskSketcherConstrains::on_comboBoxFilter_currentIndexChanged(int)
void TaskSketcherConstrains::getSelectionGeoId(QString expr, int & geoid, Sketcher::PointPos & pointpos)
{
QRegExp rxEdge(QString::fromLatin1("^Edge(\\d+)$"));
int pos = expr.indexOf(rxEdge);
geoid = Sketcher::Constraint::GeoUndef;
pointpos = Sketcher::none;
if (pos > -1) {
bool ok;
int edgeId = rxEdge.cap(1).toInt(&ok) - 1;
if (ok) {
geoid = edgeId;
}
}
else {
QRegExp rxVertex(QString::fromLatin1("^Vertex(\\d+)$"));
pos = expr.indexOf(rxVertex);
if (pos > -1) {
bool ok;
int vertexId = rxVertex.cap(1).toInt(&ok) - 1;
if (ok) {
const Sketcher::SketchObject * sketch = sketchView->getSketchObject();
sketch->getGeoVertexIndex(vertexId, geoid, pointpos);
}
}
}
}
void TaskSketcherConstrains::on_comboBoxFilter_currentIndexChanged(int filterindex)
{
selectionFilter.clear(); // reset the stored selection filter
associatedConstraintsFilter.clear();
if(filterindex == ConstraintFilter::SpecialFilterValue::Selection) {
updateSelectionFilter();
}
else if(filterindex == ConstraintFilter::SpecialFilterValue::AssociatedConstraints) {
updateAssociatedConstraintsFilter();
}
updateList();
}
@@ -909,14 +1066,43 @@ void TaskSketcherConstrains::on_filterInternalAlignment_stateChanged(int state)
void TaskSketcherConstrains::on_visualisationTrackingFilter_stateChanged(int state)
{
if(state)
// Synchronise button drop state
{
QSignalBlocker block(this);
if(ui->visibilityButton->actions()[0]->isChecked() != (state == Qt::Checked))
ui->visibilityButton->actions()[0]->setChecked(state);
}
if(state == Qt::Checked)
change3DViewVisibilityToTrackFilter();
}
void TaskSketcherConstrains::on_visibilityButton_trackingaction_changed()
{
// synchronise VisualisationTrackingFilter parameter
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool visibilityTracksFilter = hGrp->GetBool("VisualisationTrackingFilter",false);
bool bstate = ui->visibilityButton->actions()[0]->isChecked();
if(visibilityTracksFilter != bstate) {
hGrp->SetBool("VisualisationTrackingFilter", bstate);
}
// Act
if(bstate)
change3DViewVisibilityToTrackFilter();
}
void TaskSketcherConstrains::on_visibilityButton_clicked(bool)
{
change3DViewVisibilityToTrackFilter();
}
void TaskSketcherConstrains::on_extendedInformation_stateChanged(int state)
{
Q_UNUSED(state);
this->ui->extendedInformation->onSave();
slotConstraintsChanged();
}
@@ -932,12 +1118,17 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemSelectionChanged(void)
bool block = this->blockConnection(true); // avoid to be notified by itself
Gui::Selection().clearSelection();
std::vector<std::string> constraintSubNames;
QList<QListWidgetItem *> items = ui->listWidgetConstraints->selectedItems();
for (QList<QListWidgetItem *>::iterator it = items.begin(); it != items.end(); ++it) {
std::string constraint_name(Sketcher::PropertyConstraintList::getConstraintName(static_cast<ConstraintItem*>(*it)->ConstraintNbr));
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), constraint_name.c_str());
constraintSubNames.push_back(constraint_name);
}
if(!constraintSubNames.empty())
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), constraintSubNames);
this->blockConnection(block);
}
@@ -1120,12 +1311,14 @@ bool TaskSketcherConstrains::isConstraintFiltered(QListWidgetItem * item)
const Sketcher::Constraint * constraint = vals[it->ConstraintNbr];
int Filter = ui->comboBoxFilter->currentIndex();
bool hideInternalAlignment = this->ui->filterInternalAlignment->isChecked();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool hideInternalAlignment = hGrp->GetBool("HideInternalAlignment",false);
bool visible = true;
bool showAll = (Filter == FilterValue::All);
bool showGeometric = (Filter == FilterValue::Geometric);
bool showDatums = (Filter == FilterValue::Datums);
bool showDatums = (Filter == FilterValue::Datums && constraint->isDriving);
bool showNamed = (Filter == FilterValue::Named && !(constraint->Name.empty()));
bool showNonDriving = (Filter == FilterValue::NonDriving && !constraint->isDriving);
@@ -1210,6 +1403,14 @@ bool TaskSketcherConstrains::isConstraintFiltered(QListWidgetItem * item)
break;
}
// Constraint Type independent, selection filter
visible = visible || (Filter == SpecialFilterValue::Selection &&
std::find(selectionFilter.begin(), selectionFilter.end(), it->ConstraintNbr) != selectionFilter.end());
// Constraint Type independent, associated Constraints Filter
visible = visible || (Filter == SpecialFilterValue::AssociatedConstraints &&
std::find(associatedConstraintsFilter.begin(), associatedConstraintsFilter.end(), it->ConstraintNbr) != associatedConstraintsFilter.end());
return !visible;
}
@@ -1274,6 +1475,11 @@ void TaskSketcherConstrains::changeEvent(QEvent *e)
}
}
template <class T>
bool TaskSketcherConstrains::isFilter(T filterValue) {
return (ui->comboBoxFilter->currentIndex() == filterValue);
}
#include "moc_TaskSketcherConstrains.cpp"

View File

@@ -29,6 +29,8 @@
#include <boost_signals2.hpp>
#include <QListWidget>
#include <Mod/Sketcher/App/Constraint.h>
#include "ConstraintFilters.h"
namespace App {
@@ -92,8 +94,15 @@ private:
bool isConstraintFiltered(QListWidgetItem * item);
void change3DViewVisibilityToTrackFilter();
void changeFilteredVisibility(bool show, ActionTarget target = ActionTarget::All);
void updateMultiFilter();
void updateSelectionFilter();
void updateAssociatedConstraintsFilter();
void updateList();
void createVisibilityButtonActions();
template <class T>
bool isFilter(T filterValue);
void getSelectionGeoId(QString expr, int & geoid, Sketcher::PointPos & pos);
public Q_SLOTS:
void on_comboBoxFilter_currentIndexChanged(int);
@@ -106,11 +115,14 @@ public Q_SLOTS:
void on_filterInternalAlignment_stateChanged(int state);
void on_extendedInformation_stateChanged(int state);
void on_visualisationTrackingFilter_stateChanged(int state);
void on_visibilityButton_trackingaction_changed();
void on_visibilityButton_clicked(bool);
void on_showAllButton_clicked(bool);
void on_hideAllButton_clicked(bool);
void on_listWidgetConstraints_emitShowSelection3DVisibility();
void on_listWidgetConstraints_emitHideSelection3DVisibility();
void on_multipleFilterButton_clicked(bool);
void on_settingsDialogButton_clicked(bool);
protected:
void changeEvent(QEvent *e);
@@ -123,6 +135,8 @@ private:
bool inEditMode;
std::unique_ptr<Ui_TaskSketcherConstrains> ui;
std::bitset<ConstraintFilter::FilterValue::NumFilterValue> multiFilterStatus;
std::vector<unsigned int> selectionFilter;
std::vector<unsigned int> associatedConstraintsFilter;
};
} //namespace SketcherGui

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>325</width>
<width>417</width>
<height>388</height>
</rect>
</property>
@@ -30,6 +30,12 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Filter:</string>
</property>
@@ -37,6 +43,12 @@
</item>
<item>
<widget class="QComboBox" name="comboBoxFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@@ -67,7 +79,12 @@
</item>
<item>
<property name="text">
<string>Horizontal</string>
<string>Coincident</string>
</property>
</item>
<item>
<property name="text">
<string>Point on Object</string>
</property>
</item>
<item>
@@ -77,12 +94,7 @@
</item>
<item>
<property name="text">
<string>Coincident</string>
</property>
</item>
<item>
<property name="text">
<string>Point on Object</string>
<string>Horizontal</string>
</property>
</item>
<item>
@@ -115,11 +127,6 @@
<string>Block</string>
</property>
</item>
<item>
<property name="text">
<string>Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Horizontal Distance</string>
@@ -130,6 +137,11 @@
<string>Vertical Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Distance</string>
</property>
</item>
<item>
<property name="text">
<string>Radius</string>
@@ -165,6 +177,16 @@
<string>Multiple Filters</string>
</property>
</item>
<item>
<property name="text">
<string>Selection Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Associated Constraint Filter</string>
</property>
</item>
</widget>
</item>
<item>
@@ -181,54 +203,42 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Click to select multiple filters</string>
</property>
<property name="text">
<string>...</string>
<string>Select Multiple</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="settingsDialogButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Settings</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Resources/Sketcher.qrc">
<normaloff>:/icons/dialogs/Sketcher_Settings.svg</normaloff>:/icons/dialogs/Sketcher_Settings.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>95</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="visualisationTab">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title">
<string>View</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="showAllButton">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>135</width>
<height>27</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -240,17 +250,11 @@
<string>Show Listed</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hideAllButton">
<property name="geometry">
<rect>
<x>150</x>
<y>10</y>
<width>135</width>
<height>27</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -262,132 +266,39 @@
<string>Hide Listed</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="automationTab">
<property name="toolTip">
<string>Controls visualisation in the 3D view</string>
</property>
<attribute name="title">
<string>Automation</string>
</attribute>
<widget class="Gui::PrefCheckBox" name="visualisationTrackingFilter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>271</width>
<height>36</height>
</rect>
</property>
</item>
<item>
<widget class="QToolButton" name="visibilityButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Constraint visualisation tracks filter selection so that filtered out constraints are hidden</string>
<string>Restricts 3D visibility to the listed elements</string>
</property>
<property name="text">
<string>Show only filtered constraints</string>
<string>Restrict Visibility</string>
</property>
<property name="checked">
<bool>false</bool>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="prefEntry" stdset="0">
<cstring>VisualisationTrackingFilter</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</widget>
<widget class="QWidget" name="controlTab">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Controls widget list behaviour</string>
</property>
<attribute name="title">
<string>List</string>
</attribute>
<widget class="Gui::PrefCheckBox" name="extendedInformation">
<property name="geometry">
<rect>
<x>0</x>
<y>30</y>
<width>189</width>
<height>36</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Extended information will be added to the list</string>
</property>
<property name="text">
<string>Extended information</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ExtendedConstraintInformation</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
<widget class="Gui::PrefCheckBox" name="filterInternalAlignment">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>189</width>
<height>36</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Internal alignments will be hidden</string>
</property>
<property name="text">
<string>Hide internal alignment</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>HideInternalAlignment</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ConstraintView" name="listWidgetConstraints">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="modelColumn">
<number>0</number>
</property>
@@ -401,12 +312,9 @@
<extends>QListWidget</extends>
<header location="global">QListWidget</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="Resources/Sketcher.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -512,6 +512,8 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
bool block = this->blockConnection(true); // avoid to be notified by itself
Gui::Selection().clearSelection();
std::vector<std::string> elementSubNames;
for (int i=0;i<ui->listWidgetElements->count(); i++) {
ElementItem * ite=static_cast<ElementItem*>(ui->listWidgetElements->item(i));
@@ -566,7 +568,7 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
if (ite->isLineSelected) {
ss << "Edge" << ite->ElementNbr + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
}
if (ite->isStartingPointSelected) {
@@ -574,7 +576,7 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
vertex= ite->StartingVertex;
if (vertex!=-1) {
ss << "Vertex" << vertex + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
}
}
@@ -583,7 +585,7 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
vertex= ite->EndVertex;
if (vertex!=-1) {
ss << "Vertex" << vertex + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
}
}
@@ -592,11 +594,15 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
vertex= ite->MidVertex;
if (vertex!=-1) {
ss << "Vertex" << vertex + 1;
Gui::Selection().addSelection(doc_name.c_str(), obj_name.c_str(), ss.str().c_str());
elementSubNames.push_back(ss.str());
}
}
}
if (!elementSubNames.empty()) {
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), elementSubNames);
}
this->blockConnection(block);
ui->listWidgetElements->blockSignals(false);

View File

@@ -4425,7 +4425,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every information visual node gets its own material for to-be-implemented preselection and selection
@@ -4478,7 +4478,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every information visual node gets its own material for to-be-implemented preselection and selection
@@ -4608,7 +4608,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every information visual node gets its own material for to-be-implemented preselection and selection
@@ -4702,7 +4702,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every information visual node gets its own material for to-be-implemented preselection and selection
@@ -4771,7 +4771,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator* sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every information visual node gets its own material for to-be-implemented preselection and selection
@@ -5966,7 +5966,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
// root separator for one constraint
SoSeparator *sep = new SoSeparator();
sep->ref();
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
sep->renderCaching = SoSeparator::OFF;
// every constrained visual node gets its own material for preselection and selection
@@ -6799,7 +6799,7 @@ void ViewProviderSketch::createEditInventorNodes(void)
ps->style.setValue(SoPickStyle::UNPICKABLE);
Coordsep->addChild(ps);
Coordsep->setName("CoordSeparator");
// no caching for fluctuand data structures
// no caching for frequently-changing data structures
Coordsep->renderCaching = SoSeparator::OFF;
SoMaterial *CoordTextMaterials = new SoMaterial;