diff --git a/src/Mod/Part/App/TopoShapeCache.cpp b/src/Mod/Part/App/TopoShapeCache.cpp index ec82c84c02..5db0698191 100644 --- a/src/Mod/Part/App/TopoShapeCache.cpp +++ b/src/Mod/Part/App/TopoShapeCache.cpp @@ -151,6 +151,10 @@ int TopoShapeCache::Ancestry::count() const return shapes.Extent(); } +bool TopoShapeCache::Ancestry::empty() const +{ + return shapes.IsEmpty(); +} TopoShapeCache::TopoShapeCache(const TopoDS_Shape& tds) : shape(tds.Located(TopLoc_Location())) diff --git a/src/Mod/Part/App/TopoShapeCache.h b/src/Mod/Part/App/TopoShapeCache.h index 190bfe3b28..4113c2eabd 100644 --- a/src/Mod/Part/App/TopoShapeCache.h +++ b/src/Mod/Part/App/TopoShapeCache.h @@ -114,6 +114,7 @@ public: int find(const TopoDS_Shape& parent, const TopoDS_Shape& subShape); TopoDS_Shape find(const TopoDS_Shape& parent, int index); int count() const; + bool empty() const; friend TopoShapeCache; }; diff --git a/src/Mod/Part/App/TopoShapeExpansion.cpp b/src/Mod/Part/App/TopoShapeExpansion.cpp index 11cdc6e3c7..b5a28ed9a5 100644 --- a/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -860,7 +860,7 @@ void TopoShape::mapSubElementForShape(const TopoShape& other, const char* op) for (auto type : types) { auto& shapeMap = _cache->getAncestry(type); auto& otherMap = other._cache->getAncestry(type); - if ((shapeMap.count() == 0) || (otherMap.count() == 0)) { + if ((shapeMap.empty()) || (otherMap.empty())) { continue; } @@ -1450,7 +1450,7 @@ TopoShape& TopoShape::makeShapeWithElementMap(const TopoDS_Shape& shape, continue; } auto& otherMap = incomingShape._cache->getAncestry(info.type); - if (otherMap.count() == 0) { + if (otherMap.empty()) { continue; } for (int i = 1; i <= otherMap.count(); i++) { diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index c40a719547..96ee71a95b 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -952,7 +952,7 @@ void TaskAttacher::updateListOfModes() //first up, remember currently selected mode. eMapMode curMode = mmDeactivated; auto sel = ui->listOfModes->selectedItems(); - if (sel.count() > 0) + if (!sel.isEmpty()) curMode = modesInList[ui->listOfModes->row(sel[0])]; //obtain list of available modes: @@ -1054,7 +1054,7 @@ void TaskAttacher::selectMapMode(eMapMode mmode) { Attacher::eMapMode TaskAttacher::getActiveMapMode() { auto sel = ui->listOfModes->selectedItems(); - if (sel.count() > 0) + if (!sel.isEmpty()) return modesInList[ui->listOfModes->row(sel[0])]; else { if (this->lastSuggestResult.message == SuggestResult::srOK)