Merge branch 'master' into bugfix/thread-milling-task-panel
This commit is contained in:
@@ -1143,7 +1143,7 @@ PyObject* TopoShapePy::generalFuse(PyObject *args)
|
||||
TopoDS_Shape gfaResultShape = this->getTopoShapePtr()->generalFuse(shapeVec,tolerance,&map);
|
||||
Py::Object shapePy = shape2pyshape(gfaResultShape);
|
||||
Py::List mapPy;
|
||||
for(TopTools_ListOfShape &shapes: map){
|
||||
for(TopTools_ListOfShape &shapes : map) {
|
||||
Py::List shapesPy;
|
||||
for(TopTools_ListIteratorOfListOfShape it(shapes); it.More(); it.Next()){
|
||||
shapesPy.append(shape2pyshape(it.Value()));
|
||||
@@ -1247,7 +1247,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
|
||||
|
||||
namespace Part {
|
||||
// Containers to associate TopAbs_ShapeEnum values to each TopoShape*Py class
|
||||
const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
static const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapeCompoundPy::Type, TopAbs_COMPOUND},
|
||||
{&TopoShapeCompSolidPy::Type, TopAbs_COMPSOLID},
|
||||
{&TopoShapeSolidPy::Type, TopAbs_SOLID},
|
||||
@@ -1259,7 +1259,7 @@ const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapePy::Type, TopAbs_SHAPE}
|
||||
};
|
||||
|
||||
const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
static const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
vecTypeShape.begin(), vecTypeShape.end());
|
||||
|
||||
// Returns shape type of a Python type. Similar to TopAbs::ShapeTypeFromString.
|
||||
@@ -1271,7 +1271,7 @@ static TopAbs_ShapeEnum ShapeTypeFromPyType(PyTypeObject* pyType)
|
||||
return it->second;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
|
||||
@@ -2494,55 +2494,13 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRepExtrema_ShapeProximity proximity;
|
||||
proximity.LoadShape1 (s1);
|
||||
proximity.LoadShape2 (s2);
|
||||
if (tol > 0.0)
|
||||
if (tol > 0.0) {
|
||||
proximity.SetTolerance (tol);
|
||||
}
|
||||
|
||||
proximity.Perform();
|
||||
if (!proximity.IsDone()) {
|
||||
// the proximity failed, maybe it's because the shapes are not yet mesh
|
||||
TopLoc_Location aLoc;
|
||||
TopExp_Explorer xp(s1, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Triangulation)& aTriangulation =
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
xp.Init(s2, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Triangulation)& aTriangulation =
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// check also for free edges
|
||||
xp.Init(s1, TopAbs_EDGE, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Polygon3D)& aPoly3D =
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
xp.Init(s2, TopAbs_EDGE, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Polygon3D)& aPoly3D =
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// another problem must have occurred
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done");
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity failed, make sure the shapes are tessellated");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -729,7 +729,7 @@ double BSpline::getLinCombFactor(double x, size_t k, size_t i)
|
||||
|
||||
std::vector d(degree + 1, 0.0);
|
||||
// Ensure this is within range
|
||||
int idxOfPole = i + degree - k;
|
||||
int idxOfPole = static_cast<int>(i) + degree - static_cast<int>(k);
|
||||
if (idxOfPole < 0 || idxOfPole > degree)
|
||||
return 0.0;
|
||||
d[idxOfPole] = 1.0;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
|
||||
* *
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
|
||||
#include <Gui/Command.h>
|
||||
|
||||
#include <QWidgetAction> //to be put in _PreComp_ once grid PR merge.
|
||||
|
||||
using namespace SketcherGui;
|
||||
using namespace Gui::TaskView;
|
||||
|
||||
@@ -371,7 +373,7 @@ ElementItem* ElementView::itemFromIndex(const QModelIndex& index) {
|
||||
return static_cast<ElementItem*>(QListWidget::itemFromIndex(index));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/* ElementItem delegate ---------------------------------------------------- */
|
||||
|
||||
ElementItemDelegate::ElementItemDelegate(ElementView* parent) : QStyledItemDelegate(parent)
|
||||
{ // This class relies on the parent being an ElementView, see getElementtItem
|
||||
@@ -486,7 +488,44 @@ ElementItem* ElementItemDelegate::getElementtItem(const QModelIndex& index) cons
|
||||
ElementView* elementView = static_cast<ElementView*>(parent());
|
||||
return elementView->itemFromIndex(index);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/* Filter element list widget ------------------------------------------------------ */
|
||||
ElementFilterList::ElementFilterList(QWidget* parent) : QListWidget(parent)
|
||||
{
|
||||
for (auto const &filterItem:filterItems) {
|
||||
Q_UNUSED(filterItem);
|
||||
auto it = new QListWidgetItem();
|
||||
it->setFlags(it->flags() | Qt::ItemIsUserCheckable);
|
||||
it->setCheckState(Qt::Checked);
|
||||
addItem(it);
|
||||
}
|
||||
languageChange();
|
||||
}
|
||||
|
||||
ElementFilterList::~ElementFilterList()
|
||||
{
|
||||
}
|
||||
|
||||
void ElementFilterList::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
languageChange();
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
void ElementFilterList::languageChange()
|
||||
{
|
||||
assert(static_cast<int>(filterItems.size()) == count());
|
||||
int i=0;
|
||||
for (auto const &filterItem:filterItems) {
|
||||
auto text = QStringLiteral(" ").repeated(filterItem.second-1) +
|
||||
(filterItem.second > 0 ? QStringLiteral("- ") : QStringLiteral()) +
|
||||
tr(filterItem.first);
|
||||
item(i++)->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TRANSLATOR SketcherGui::TaskSketcherElements */
|
||||
|
||||
@@ -499,7 +538,6 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
, previouslyHoveredItemIndex(-1)
|
||||
, previouslyHoveredType(SubElementType::none)
|
||||
, isNamingBoxChecked(false)
|
||||
, collapseFilter(true)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
@@ -518,6 +556,7 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers);
|
||||
ui->listWidgetElements->setMouseTracking(true);
|
||||
|
||||
createFilterButtonActions();
|
||||
createSettingsButtonActions();
|
||||
|
||||
connectSignals();
|
||||
@@ -526,23 +565,6 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
|
||||
|
||||
slotElementsChanged();
|
||||
|
||||
// make filter items checkable
|
||||
{
|
||||
QSignalBlocker sigblk(ui->listMultiFilter);
|
||||
for (int i = 0; i < ui->listMultiFilter->count(); i++) {
|
||||
QListWidgetItem* item = ui->listMultiFilter->item(i);
|
||||
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
ui->listMultiFilter->setVisible(false);
|
||||
}
|
||||
|
||||
this->installEventFilter(this);
|
||||
ui->filterBox->installEventFilter(this);
|
||||
ui->listMultiFilter->installEventFilter(this);
|
||||
}
|
||||
|
||||
TaskSketcherElements::~TaskSketcherElements()
|
||||
@@ -566,7 +588,7 @@ void TaskSketcherElements::connectSignals()
|
||||
this, &TaskSketcherElements::onListWidgetElementsMouseMoveOnItem
|
||||
);
|
||||
QObject::connect(
|
||||
ui->listMultiFilter, &QListWidget::itemChanged,
|
||||
filterList, &QListWidget::itemChanged,
|
||||
this, &TaskSketcherElements::onListMultiFilterItemChanged
|
||||
);
|
||||
QObject::connect(
|
||||
@@ -575,15 +597,15 @@ void TaskSketcherElements::connectSignals()
|
||||
);
|
||||
QObject::connect(
|
||||
ui->settingsButton, &QToolButton::clicked,
|
||||
this, &TaskSketcherElements::onSettingsButtonClicked
|
||||
ui->settingsButton, &QToolButton::showMenu
|
||||
);
|
||||
QObject::connect(
|
||||
qAsConst(ui->settingsButton)->actions()[0], &QAction::changed,
|
||||
this, &TaskSketcherElements::onSettingsExtendedInformationChanged
|
||||
);
|
||||
QObject::connect(
|
||||
qAsConst(ui->settingsButton)->actions()[1], &QAction::changed,
|
||||
this, &TaskSketcherElements::onSettingsAutoCollapseFilterChanged
|
||||
ui->filterButton, &QToolButton::clicked,
|
||||
ui->filterButton, &QToolButton::showMenu
|
||||
);
|
||||
|
||||
connectionElementsChanged = sketchView->signalElementsChanged.connect(
|
||||
@@ -592,29 +614,19 @@ void TaskSketcherElements::connectSignals()
|
||||
|
||||
/* filter functions --------------------------------------------------- */
|
||||
|
||||
void TaskSketcherElements::onFilterBoxStateChanged(int val)
|
||||
void TaskSketcherElements::createFilterButtonActions()
|
||||
{
|
||||
Q_UNUSED(val)
|
||||
|
||||
ui->listMultiFilter->setVisible(ui->filterBox->checkState() == Qt::Checked);
|
||||
|
||||
slotElementsChanged();
|
||||
auto* action = new QWidgetAction(this);
|
||||
filterList = new ElementFilterList(this);
|
||||
action->setDefaultWidget(filterList);
|
||||
qAsConst(ui->filterButton)->addAction(action);
|
||||
}
|
||||
|
||||
bool TaskSketcherElements::eventFilter(QObject* obj, QEvent* event)
|
||||
void TaskSketcherElements::onFilterBoxStateChanged(int val)
|
||||
{
|
||||
if (collapseFilter) {
|
||||
if (obj == qobject_cast<QObject*>(ui->filterBox) && event->type() == QEvent::Enter && ui->filterBox->checkState() == Qt::Checked) {
|
||||
ui->listMultiFilter->show();
|
||||
}
|
||||
else if (obj == qobject_cast<QObject*>(ui->listMultiFilter) && event->type() == QEvent::Leave) {
|
||||
ui->listMultiFilter->hide();
|
||||
}
|
||||
else if (obj == this && event->type() == QEvent::Leave) {
|
||||
ui->listMultiFilter->hide();
|
||||
}
|
||||
}
|
||||
return TaskBox::eventFilter(obj, event);
|
||||
Q_UNUSED(val);
|
||||
ui->filterButton->setEnabled(ui->filterBox->checkState() == Qt::Checked);
|
||||
slotElementsChanged();
|
||||
}
|
||||
|
||||
enum class GeoFilterType { NormalGeos,
|
||||
@@ -636,13 +648,33 @@ enum class GeoFilterType { NormalGeos,
|
||||
void TaskSketcherElements::onListMultiFilterItemChanged(QListWidgetItem* item)
|
||||
{
|
||||
{
|
||||
int start = 4; //From 4 to the end, it's the geometry types (line, circle, arc...)
|
||||
QSignalBlocker sigblk(ui->listMultiFilter);
|
||||
if (item == ui->listMultiFilter->item(static_cast<int>(GeoFilterType::AllGeosTypes))) {
|
||||
for (int i = start; i < ui->listMultiFilter->count(); i++) {
|
||||
ui->listMultiFilter->item(i)->setCheckState(item->checkState());
|
||||
QSignalBlocker sigblk(filterList);
|
||||
|
||||
int index = filterList->row(item);
|
||||
int indexOfAllTypes = static_cast<int>(GeoFilterType::AllGeosTypes);
|
||||
|
||||
if (index == indexOfAllTypes) {
|
||||
for (int i = indexOfAllTypes + 1; i < filterList->count(); i++) {
|
||||
filterList->item(i)->setCheckState(item->checkState());
|
||||
}
|
||||
}
|
||||
else if (index > indexOfAllTypes) {
|
||||
bool atLeastOneUnchecked = false;
|
||||
bool atLeastOneChecked = false;
|
||||
|
||||
for (int i = indexOfAllTypes + 1; i < filterList->count(); i++) {
|
||||
if (filterList->item(i)->checkState() == Qt::Checked)
|
||||
atLeastOneChecked = true;
|
||||
if (filterList->item(i)->checkState() == Qt::Unchecked)
|
||||
atLeastOneUnchecked = true;
|
||||
}
|
||||
if (atLeastOneChecked && atLeastOneUnchecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::PartiallyChecked);
|
||||
else if(atLeastOneUnchecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::Unchecked);
|
||||
else if(atLeastOneChecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
@@ -656,19 +688,19 @@ void TaskSketcherElements::setItemVisibility(QListWidgetItem* it)
|
||||
|
||||
using GeometryState = ElementItem::GeometryState;
|
||||
|
||||
if ((ui->listMultiFilter->item(static_cast<int>(GeoFilterType::NormalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Normal) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ConstructionGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Construction) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::InternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::InternalAlignment) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ExternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::External) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::PointGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomPoint::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::LineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomLineSegment::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::CircleGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomCircle::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::EllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomEllipse::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ArcGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfCircle::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ArcOfEllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfEllipse::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::HyperbolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfHyperbola::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ParabolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfParabola::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::BSplineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomBSplineCurve::getClassTypeId()) )
|
||||
if ((filterList->item(static_cast<int>(GeoFilterType::NormalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Normal) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ConstructionGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Construction) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::InternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::InternalAlignment) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ExternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::External) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::PointGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomPoint::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::LineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomLineSegment::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::CircleGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomCircle::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::EllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomEllipse::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ArcGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfCircle::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ArcOfEllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfEllipse::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::HyperbolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfHyperbola::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ParabolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfParabola::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::BSplineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomBSplineCurve::getClassTypeId()) )
|
||||
{
|
||||
item->setHidden(true);
|
||||
return;
|
||||
@@ -1180,23 +1212,18 @@ void TaskSketcherElements::changeEvent(QEvent *e)
|
||||
void TaskSketcherElements::createSettingsButtonActions()
|
||||
{
|
||||
QAction* action = new QAction(tr("Extended information"), this);
|
||||
QAction* action2 = new QAction(tr("Auto collapse filter"), this);
|
||||
|
||||
action->setCheckable(true);
|
||||
action2->setCheckable(true);
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
{
|
||||
QSignalBlocker block(this);
|
||||
action->setChecked(hGrp->GetBool("ExtendedNaming", false));
|
||||
action2->setChecked(hGrp->GetBool("AutoCollapseFilter", false));
|
||||
}
|
||||
|
||||
ui->settingsButton->addAction(action);
|
||||
ui->settingsButton->addAction(action2);
|
||||
|
||||
isNamingBoxChecked = hGrp->GetBool("ExtendedNaming", false);
|
||||
collapseFilter = hGrp->GetBool("AutoCollapseFilter", true);
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsExtendedInformationChanged()
|
||||
@@ -1210,25 +1237,4 @@ void TaskSketcherElements::onSettingsExtendedInformationChanged()
|
||||
slotElementsChanged();
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsAutoCollapseFilterChanged()
|
||||
{
|
||||
QList<QAction*> acts = ui->settingsButton->actions();
|
||||
collapseFilter = acts[1]->isChecked();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
hGrp->SetBool("AutoCollapseFilter", collapseFilter);
|
||||
|
||||
if (collapseFilter) {
|
||||
ui->listMultiFilter->setVisible(false);
|
||||
}
|
||||
else {
|
||||
ui->listMultiFilter->setVisible(ui->filterBox->checkState() == Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsButtonClicked(bool)
|
||||
{
|
||||
ui->settingsButton->showMenu();
|
||||
}
|
||||
|
||||
#include "moc_TaskSketcherElements.cpp"
|
||||
|
||||
@@ -69,7 +69,7 @@ class ElementItem : public QListWidgetItem
|
||||
, StartingVertex(startingVertex)
|
||||
, MidVertex(midVertex)
|
||||
, EndVertex(endVertex)
|
||||
, GeometryType(geometryType)
|
||||
, GeometryType(std::move(geometryType))
|
||||
, State(state)
|
||||
, isLineSelected(false)
|
||||
, isStartingPointSelected(false)
|
||||
@@ -177,6 +177,39 @@ Q_SIGNALS:
|
||||
void onItemHovered(QListWidgetItem *);
|
||||
};
|
||||
|
||||
class ElementFilterList : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementFilterList(QWidget* parent = nullptr);
|
||||
~ElementFilterList() override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent* e) override;
|
||||
virtual void languageChange();
|
||||
|
||||
private:
|
||||
using filterItemRepr = std::pair<const char *, const int>; // {filter item text, filter item level}
|
||||
inline static const std::vector<filterItemRepr> filterItems = {
|
||||
{QT_TR_NOOP("Normal"),0},
|
||||
{QT_TR_NOOP("Construction"),0},
|
||||
{QT_TR_NOOP("Internal"),0},
|
||||
{QT_TR_NOOP("External"),0},
|
||||
{QT_TR_NOOP("All types"),0},
|
||||
{QT_TR_NOOP("Point"),1},
|
||||
{QT_TR_NOOP("Line"),1},
|
||||
{QT_TR_NOOP("Circle"),1},
|
||||
{QT_TR_NOOP("Ellipse"),1},
|
||||
{QT_TR_NOOP("Arc of circle"),1},
|
||||
{QT_TR_NOOP("Arc of ellipse"),1},
|
||||
{QT_TR_NOOP("Arc of hyperbola"),1},
|
||||
{QT_TR_NOOP("Arc of parabola"),1},
|
||||
{QT_TR_NOOP("B-Spline"),1}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class TaskSketcherElements : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -188,13 +221,12 @@ public:
|
||||
/// Observer message from the Selection
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
|
||||
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
private:
|
||||
void slotElementsChanged();
|
||||
void updateVisibility();
|
||||
void setItemVisibility(QListWidgetItem* item);
|
||||
void clearWidget();
|
||||
void createFilterButtonActions();
|
||||
void createSettingsButtonActions();
|
||||
void connectSignals();
|
||||
|
||||
@@ -203,8 +235,6 @@ public Q_SLOTS:
|
||||
void onListWidgetElementsItemEntered(QListWidgetItem *item);
|
||||
void onListWidgetElementsMouseMoveOnItem(QListWidgetItem* item);
|
||||
void onSettingsExtendedInformationChanged();
|
||||
void onSettingsAutoCollapseFilterChanged();
|
||||
void onSettingsButtonClicked(bool);
|
||||
void onFilterBoxStateChanged(int val);
|
||||
void onListMultiFilterItemChanged(QListWidgetItem* item);
|
||||
|
||||
@@ -224,8 +254,9 @@ private:
|
||||
int previouslyHoveredItemIndex;
|
||||
SubElementType previouslyHoveredType;
|
||||
|
||||
ElementFilterList* filterList;
|
||||
|
||||
bool isNamingBoxChecked;
|
||||
bool collapseFilter;
|
||||
};
|
||||
|
||||
} //namespace SketcherGui
|
||||
|
||||
@@ -30,17 +30,48 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout1">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="filterBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check to activate filters</string>
|
||||
<string>Check to toggle filters</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-bottom: 0px; margin-bottom: 0px</string>
|
||||
<string notr="true">padding-right: 0px; margin-right: 0px</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="filterButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to show filters</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-left: 0px; margin-left: 0px</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -69,98 +100,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listMultiFilter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-top: 0px; margin-top: 0px</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Construction</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Internal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>External</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All types</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Point</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Line</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Ellipse </string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of ellipse</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of hyperbola</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of parabola</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - B-Spline</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElementView" name="listWidgetElements">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# FreeCAD init script of the Sketcher module
|
||||
# (c) 2001 Juergen Riegel
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* Copyright (c) 2001,2002 Juergen Riegel <juergen.riegel@web.de> *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
@@ -13,17 +10,17 @@
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Lesser General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
# FreeCAD init script of the Sketcher module
|
||||
|
||||
FreeCAD.__unit_test__ += [ "TestSketcherApp" ]
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
# Sketcher gui init module
|
||||
# (c) 2003 Juergen Riegel
|
||||
#
|
||||
# Gathering all the information to start FreeCAD
|
||||
# This is the second one of three init scripts, the third one
|
||||
# runs when the gui is up
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* Copyright (c) 2002,2003 Juergen Riegel <juergen.riegel@web.de> *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
@@ -26,10 +19,13 @@
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
|
||||
# Sketcher gui init module
|
||||
#
|
||||
# Gathering all the information to start FreeCAD
|
||||
# This is the second one of three init scripts, the third one
|
||||
# runs when the gui is up
|
||||
|
||||
class SketcherWorkbench ( Workbench ):
|
||||
"Sketcher workbench object"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# (c) Emmanuel O'Brien 2021 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2021 Emmanuel O'Brien *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# (c) Juergen Riegel (FreeCAD@juergen-riegel.net) 2011 LGPL *
|
||||
# (c) Emmanuel O'Brien 2021 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# Copyright (c) 2021 Emmanuel O'Brien *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# (c) Juergen Riegel (FreeCAD@juergen-riegel.net) 2011 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -438,6 +438,14 @@ void DrawViewPart::postHlrTasks(void)
|
||||
for (auto& b : bals) {
|
||||
b->recomputeFeature();
|
||||
}
|
||||
// Dimensions need to be recomputed now, unless their recomputation must be postponed
|
||||
// until face creation, in which case they are recomputed after that
|
||||
if (!handleFaces() || CoarseView.getValue()) {
|
||||
std::vector<TechDraw::DrawViewDimension*> dims = getDimensions();
|
||||
for (auto& d : dims) {
|
||||
d->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
//second pass if required
|
||||
if (ScaleType.isValue("Automatic") &&
|
||||
@@ -453,7 +461,7 @@ void DrawViewPart::postHlrTasks(void)
|
||||
requestPaint();
|
||||
}
|
||||
|
||||
//run any tasks that need to been done after faces are available
|
||||
// Run any tasks that need to be done after faces are available
|
||||
void DrawViewPart::postFaceExtractionTasks(void)
|
||||
{
|
||||
// Some centerlines depend on faces so we could not add CL geometry before now
|
||||
|
||||
Reference in New Issue
Block a user