From b63f380f61d5c71c9e10971825b26c9bc6b96f9a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 11 Jun 2020 14:15:04 +0200 Subject: [PATCH 01/46] Draft: Allow to define rounding value in DraftVecUtils.rounded --- src/Mod/Draft/DraftVecUtils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/DraftVecUtils.py b/src/Mod/Draft/DraftVecUtils.py index 87fbfbf7d5..9467b8c364 100644 --- a/src/Mod/Draft/DraftVecUtils.py +++ b/src/Mod/Draft/DraftVecUtils.py @@ -703,8 +703,9 @@ def isColinear(vlist): return True -def rounded(v): - """Return a vector rounded to the `precision` in the parameter database. +def rounded(v,d=None): + """Return a vector rounded to the `precision` in the parameter database + or to the given decimals value Each of the components of the vector is rounded to the decimal precision set in the parameter database. @@ -713,6 +714,7 @@ def rounded(v): ---------- v : Base::Vector3 The input vector. + d : (Optional) the number of decimals to round to Returns ------- @@ -722,6 +724,8 @@ def rounded(v): in the parameter database. """ p = precision() + if d: + p = d return Vector(round(v.x, p), round(v.y, p), round(v.z, p)) From f98ed46ad6b7db2fabe239d988866776f6abfc12 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 11 Jun 2020 14:15:38 +0200 Subject: [PATCH 02/46] Arch: Allow to export structural analysis model to IFC --- src/Mod/Arch/CMakeLists.txt | 1 + .../Resources/ui/preferences-ifc-export.ui | 39 ++++ src/Mod/Arch/exportIFC.py | 56 ++++-- src/Mod/Arch/exportIFCHelper.py | 10 +- src/Mod/Arch/exportIFCStructuralTools.py | 180 ++++++++++++++++++ 5 files changed, 263 insertions(+), 23 deletions(-) create mode 100644 src/Mod/Arch/exportIFCStructuralTools.py diff --git a/src/Mod/Arch/CMakeLists.txt b/src/Mod/Arch/CMakeLists.txt index 151071742d..1ed820e16e 100644 --- a/src/Mod/Arch/CMakeLists.txt +++ b/src/Mod/Arch/CMakeLists.txt @@ -54,6 +54,7 @@ SET(Arch_SRCS ArchTruss.py ArchCurtainWall.py importSHP.py + exportIFCStructuralTools.py ) SET(Dice3DS_SRCS diff --git a/src/Mod/Arch/Resources/ui/preferences-ifc-export.ui b/src/Mod/Arch/Resources/ui/preferences-ifc-export.ui index 5706fac8f6..b7a136d9f5 100644 --- a/src/Mod/Arch/Resources/ui/preferences-ifc-export.ui +++ b/src/Mod/Arch/Resources/ui/preferences-ifc-export.ui @@ -39,6 +39,45 @@ Export options + + + + + + Export type + + + + + + + The type of objects you wish to export: Standard (solid objects), wireframe model for structural analysis, or both in a same model + + + ifcExportModel + + + Mod/Arch + + + + Standard model + + + + + Structural analysis + + + + + Standard + structural + + + + + + diff --git a/src/Mod/Arch/exportIFC.py b/src/Mod/Arch/exportIFC.py index f9ecbb88a3..35b8005237 100644 --- a/src/Mod/Arch/exportIFC.py +++ b/src/Mod/Arch/exportIFC.py @@ -38,6 +38,7 @@ import Arch import DraftVecUtils import ArchIFCSchema import exportIFCHelper +import exportIFCStructuralTools from DraftGeomUtils import vec from importIFCHelper import dd2dms @@ -140,7 +141,8 @@ def getPreferences(): 'ADD_DEFAULT_BUILDING': p.GetBool("IfcAddDefaultBuilding",True), 'IFC_UNIT': u, 'SCALE_FACTOR': f, - 'GET_STANDARD': p.GetBool("getStandardType",False) + 'GET_STANDARD': p.GetBool("getStandardType",False), + 'EXPORT_MODEL': ['arch','struct','hybrid'][p.GetInt("ifcExportModel",0)] } if hasattr(ifcopenshell,"schema_identifier"): schema = ifcopenshell.schema_identifier @@ -228,7 +230,7 @@ def export(exportList,filename,colors=None,preferences=None): if preferences['FULL_PARAMETRIC']: objectslist = Arch.getAllChildren(objectslist) - # create project and context + # create project, context and geodata settings contextCreator = exportIFCHelper.ContextCreator(ifcfile, objectslist) context = contextCreator.model_view_subcontext @@ -239,6 +241,16 @@ def export(exportList,filename,colors=None,preferences=None): decl = Draft.getObjectsOfType(objectslist, "Site")[0].Declination.getValueAs(FreeCAD.Units.Radian) contextCreator.model_context.TrueNorth.DirectionRatios = (math.cos(decl+math.pi/2), math.sin(decl+math.pi/2)) + # reusable entity system + + global ifcbin + ifcbin = exportIFCHelper.recycler(ifcfile) + + # setup analytic model + + if preferences['EXPORT_MODEL'] in ['struct','hybrid']: + exportIFCStructuralTools.setup(ifcfile,ifcbin,preferences['SCALE_FACTOR']) + # define holders for the different types we create products = {} # { Name: IfcEntity, ... } @@ -252,11 +264,6 @@ def export(exportList,filename,colors=None,preferences=None): shapedefs = {} # { ShapeDefString:[shapes],... } spatialelements = {} # {Name:IfcEntity, ... } - # reusable entity system - - global ifcbin - ifcbin = exportIFCHelper.recycler(ifcfile) - # build clones table if preferences['CREATE_CLONES']: @@ -279,6 +286,14 @@ def export(exportList,filename,colors=None,preferences=None): for obj in objectslist: + # structural analysis object + + structobj = None + if preferences['EXPORT_MODEL'] in ['struct','hybrid']: + structobj = exportIFCStructuralTools.createStructuralMember(ifcfile,ifcbin,obj) + if preferences['EXPORT_MODEL'] == 'struct': + continue + # getting generic data name = getText("Name",obj) @@ -453,6 +468,11 @@ def export(exportList,filename,colors=None,preferences=None): if ifctype in ["IfcBuilding","IfcBuildingStorey","IfcSite","IfcSpace"]: spatialelements[obj.Name] = product + # associate with structural analysis object if any + + if structobj: + exportIFCStructuralTools.associates(ifcfile,product,structobj) + # gather assembly subelements if assemblyElements: @@ -834,6 +854,11 @@ def export(exportList,filename,colors=None,preferences=None): count += 1 + # relate structural analysis objects to the struct model + + if preferences['EXPORT_MODEL'] in ['struct','hybrid']: + exportIFCStructuralTools.createStructuralGroup(ifcfile) + # relationships sites = [] @@ -2012,11 +2037,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess productdef = ifcfile.add(p) for rep in productdef.Representations: rep.ContextOfItems = context - xvc = ifcbin.createIfcDirection((1.0,0.0,0.0)) - zvc = ifcbin.createIfcDirection((0.0,0.0,1.0)) - ovc = ifcbin.createIfcCartesianPoint((0.0,0.0,0.0)) - gpl = ifcbin.createIfcAxis2Placement3D(ovc,zvc,xvc) - placement = ifcbin.createIfcLocalPlacement(gpl) + placement = ifcbin.createIfcLocalPlacement() shapetype = "advancedbrep" shapes = None serialized = True @@ -2124,10 +2145,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess colorshapes = shapes # to keep track of individual shapes for coloring below if tostore: subrep = ifcfile.createIfcShapeRepresentation(context,'Body',solidType,shapes) - xvc = ifcbin.createIfcDirection((1.0,0.0,0.0)) - zvc = ifcbin.createIfcDirection((0.0,0.0,1.0)) - ovc = ifcbin.createIfcCartesianPoint((0.0,0.0,0.0)) - gpl = ifcbin.createIfcAxis2Placement3D(ovc,zvc,xvc) + gpl = ifcbin.createIfcAxis2Placement3D() repmap = ifcfile.createIfcRepresentationMap(gpl,subrep) pla = obj.getGlobalPlacement() axis1 = ifcbin.createIfcDirection(tuple(pla.Rotation.multVec(FreeCAD.Vector(1,0,0)))) @@ -2194,11 +2212,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess surfstyles[key] = psa isi = ifcfile.createIfcStyledItem(shape,[psa],None) - xvc = ifcbin.createIfcDirection((1.0,0.0,0.0)) - zvc = ifcbin.createIfcDirection((0.0,0.0,1.0)) - ovc = ifcbin.createIfcCartesianPoint((0.0,0.0,0.0)) - gpl = ifcbin.createIfcAxis2Placement3D(ovc,zvc,xvc) - placement = ifcbin.createIfcLocalPlacement(gpl) + placement = ifcbin.createIfcLocalPlacement() representation = ifcfile.createIfcShapeRepresentation(context,'Body',solidType,shapes) productdef = ifcfile.createIfcProductDefinitionShape(None,None,[representation]) diff --git a/src/Mod/Arch/exportIFCHelper.py b/src/Mod/Arch/exportIFCHelper.py index 15fc89798a..4b8c98cff7 100644 --- a/src/Mod/Arch/exportIFCHelper.py +++ b/src/Mod/Arch/exportIFCHelper.py @@ -280,7 +280,11 @@ class recycler: self.propertysinglevalues[key] = c return c - def createIfcAxis2Placement3D(self,p1,p2,p3): + def createIfcAxis2Placement3D(self,p1=None,p2=None,p3=None): + if not p1: + p1 = self.createIfcCartesianPoint((0.0,0.0,0.0)) + p2 = self.createIfcDirection((0.0,0.0,1.0)) + p3 = self.createIfcDirection((1.0,0.0,0.0)) if p2: tp2 = str(p2.DirectionRatios) else: @@ -310,7 +314,9 @@ class recycler: self.axis2placement2ds[key] = c return c - def createIfcLocalPlacement(self,gpl): + def createIfcLocalPlacement(self,gpl=None): + if not gpl: + gpl = self.createIfcAxis2Placement3D() key = str(gpl.Location.Coordinates) + str(gpl.Axis.DirectionRatios) + str(gpl.RefDirection.DirectionRatios) if self.compress and key in self.localplacements: self.spared += 1 diff --git a/src/Mod/Arch/exportIFCStructuralTools.py b/src/Mod/Arch/exportIFCStructuralTools.py new file mode 100644 index 0000000000..e04da9a665 --- /dev/null +++ b/src/Mod/Arch/exportIFCStructuralTools.py @@ -0,0 +1,180 @@ +# *************************************************************************** +# * Copyright (c) 2020 Yorik van Havre * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program 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 program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +from __future__ import print_function + + +__title__ = "FreeCAD structural IFC export tools" +__author__ = "Yorik van Havre" +__url__ = "https://www.freecadweb.org" + +ALLOW_LINEAR_OBJECTS = True # allow non-solid objects (wires, etc) to become analytic objects? + +structural_nodes = {} # this keeps track of nodes during this session +scaling = 1.0 # this keeps track of scaling during this session + + +def setup(ifcfile,ifcbin,scale): + + """Creates all the needed setup for structural model.""" + + global structural_nodes,scaling + structural_nodes = {} + scaling = scale + import ifcopenshell + uid = ifcopenshell.guid.new + owh = ifcfile.by_type("IfcOwnerHistory")[0] + prj = ifcfile.by_type("IfcProject")[0] + ctx = createStructuralContext(ifcfile) + if ifcfile.wrapped_data.schema_name == "IFC2X3": + mod = ifcfile.createIfcStructuralAnalysisModel(uid(),owh,"Structural Analysis Model",None,None,"NOTDEFINED",None,None,None) + else: + pla = ifcbin.createIfcLocalPlacement() + mod = ifcfile.createIfcStructuralAnalysisModel(uid(),owh,"Structural Analysis Model",None,None,"NOTDEFINED",None,None,None,pla) + rel = ifcfile.createIfcRelDeclares(uid(),owh,None,None,prj,[mod]) + + +def createStructuralContext(ifcfile): + + """Creates an additional geometry context for structural objects. Returns the new context""" + + contexts = ifcfile.by_type("IfcGeometricRepresentationContext") + # filter out subcontexts + contexts = [c for c in contexts if c.is_a() == "IfcGeometricRepresentationContext"] + ctx = contexts[0] # arbitrarily take the first one... + structcontext = ifcfile.createIfcGeometricRepresentationSubContext('Analysis','Axis',None,None,None,None,ctx,None,"GRAPH_VIEW",None) + return structcontext + + +def getStructuralContext(ifcfile): + + """Returns the structural context from the file""" + for c in ifcfile.by_type("IfcGeometricRepresentationSubContext"): + if c.ContextIdentifier == "Analysis": + return c + + +def createStructuralNode(ifcfile,ifcbin,point): + + """Creates a connection node at the given point""" + + import ifcopenshell + uid = ifcopenshell.guid.new + owh = ifcfile.by_type("IfcOwnerHistory")[0] + ctx = getStructuralContext(ifcfile) + cpt = ifcbin.createIfcCartesianPoint(tuple(point)) + vtx = ifcfile.createIfcVertexPoint(cpt) + rep = ifcfile.createIfcTopologyRepresentation(ctx,'Analysis','Vertex',[vtx]) + psh = ifcfile.createIfcProductDefinitionShape(None,None,[rep]) + # boundary conditions serve for ex. to create fixed nodes + #cnd = ifcfile.createIfcBoundaryNodeCondition("Fixed",ifcfile.createIfcBoolean(True),ifcfile.createIfcBoolean(True),ifcfile.createIfcBoolean(True),ifcfile.createIfcBoolean(True),ifcfile.createIfcBoolean(True),ifcfile.createIfcBoolean(True)) + # for now we don't create any boundary condition + cnd = None + pla = ifcbin.createIfcLocalPlacement() + prd = ifcfile.createIfcStructuralPointConnection(uid(),owh,'Vertex',None,None,pla,psh,cnd,None) + return prd + + +def createStructuralMember(ifcfile,ifcbin,obj): + + """Creates a structural member if possible. Returns the member""" + + global structural_nodes + prd = None + import Draft + import Part + import ifcopenshell + uid = ifcopenshell.guid.new + owh = ifcfile.by_type("IfcOwnerHistory")[0] + ctx = getStructuralContext(ifcfile) + edges = None + if Draft.getType(obj) not in ["Structure"]: + if ALLOW_LINEAR_OBJECTS and obj.isDerivedFrom("Part::Feature"): + if obj.Shape.Faces: + return None + elif not obj.Shape.Edges: + return None + else: + edges = obj.Shape.Edges + else: + wire = Part.makePolygon([obj.Placement.multVec(n) for n in obj.Nodes]) + edges = wire.Edges + if not edges: + return None + for edge in edges: + if len(edge.Vertexes) > 1: + # we don't care about curved edges just now... + v0 = edge.Vertexes[0].Point.multiply(scaling) + v1 = edge.Vertexes[-1].Point.multiply(scaling) + cp1 = ifcbin.createIfcCartesianPoint(tuple(v0)) + cp2 = ifcbin.createIfcCartesianPoint(tuple(v1)) + upv = ifcbin.createIfcDirection((0,0,1)) + pla = ifcbin.createIfcLocalPlacement() + vp1 = ifcfile.createIfcVertexPoint(cp1) + vp2 = ifcfile.createIfcVertexPoint(cp2) + edg = ifcfile.createIfcEdge(vp1,vp2) + rep = ifcfile.createIfcTopologyRepresentation(ctx,'Analysis','Edge',[edg]) + psh = ifcfile.createIfcProductDefinitionShape(None,None,[rep]) + prd = ifcfile.createIfcStructuralCurveMember(uid(),owh,obj.Label,None,None,pla,psh,"RIGID_JOINED_MEMBER",upv) + # check for existing connection nodes + for v in [v0,v1]: + vk = tuple(v) + if vk in structural_nodes: + if structural_nodes[vk]: + n = structural_nodes[vk] + else: + # there is another member with same point, create a new node + n = createStructuralNode(ifcfile,ifcbin,v) + structural_nodes[vk] = n + ifcfile.createIfcRelConnectsStructuralMember(uid(),None,None,None,prd,n,None,None,None,None); + else: + # just add the point, no other member using it yet + structural_nodes[vk] = None + return prd + + +def createStructuralGroup(ifcfile): + + "Assigns all structural objects found in the file to the structual model""" + + import ifcopenshell + uid = ifcopenshell.guid.new + owh = ifcfile.by_type("IfcOwnerHistory")[0] + edges = ifcfile.by_type("IfcStructuralCurveMember") + verts = ifcfile.by_type("IfcStructuralPointConnection") + model = ifcfile.by_type("IfcStructuralAnalysisModel")[0] + if model: + members = edges + verts + if members: + ifcfile.createIfcRelAssignsToGroup(uid(),owh,None,None,members,"PRODUCT",model) + + +def associates(ifcfile,aobj,sobj): + + """Associates an arch object with a struct object""" + + # This is probably not the right way to do this, ie. relate a structural + # object with an IfcProduct. Needs to investigate more.... + + import ifcopenshell + uid = ifcopenshell.guid.new + owh = ifcfile.by_type("IfcOwnerHistory")[0] + ifcfile.createIfcRelAssignsToProduct(uid(),owh,None,None,[sobj],None,aobj) From 02a15cdbe0bc86fe2bfebc4607ab1f05232dfc1d Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 12:20:20 +0200 Subject: [PATCH 03/46] Gui: [skip ci] fix some thread issues: avoid to crash the application when trying to create thumbnail from worker thread avoid that application behaves weirdly when triggering an action update from worker thread --- src/Gui/MainWindow.cpp | 11 ++++++++++- src/Gui/Thumbnail.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 41a15ca259..9bfdc498f8 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1325,7 +1325,16 @@ void MainWindow::updateActions(bool delay) return; if (!d->activityTimer->isActive()) { - d->activityTimer->start(150); + // If for some reason updateActions() is called from a worker thread + // we must avoid to directly call QTimer::start() because this leaves + // the whole application in a weird state + if (d->activityTimer->thread() != QThread::currentThread()) { + QMetaObject::invokeMethod(d->activityTimer, "start", Qt::QueuedConnection, + QGenericReturnArgument(), Q_ARG(int, 150)); + } + else { + d->activityTimer->start(150); + } } else if (delay) { if (!d->actionUpdateDelay) diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index eccf1ef9b2..58109e8bb5 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -29,6 +29,7 @@ # include # include # include +# include #endif #include @@ -88,6 +89,11 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const return; QImage img; if (this->viewer->isActiveWindow()) { + if (this->viewer->thread() != QThread::currentThread()) { + qWarning("Cannot create a thumbnail from non-GUI thread"); + return; + } + QColor invalid; this->viewer->imageFromFramebuffer(this->size, this->size, 0, invalid, img); } From 173269422d29a03e6deff7b995519761f56dd577 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 13:32:59 +0200 Subject: [PATCH 04/46] C++: [skip ci] fix -Wredundant-move This change was part of #2720 but has been skipped in order to not complicate a pending PR of an upgrade of the SMESH sources. However, this other PR #2706 has been closed by its author. Since this warning is reported on latest Fedora version using gcc 10 it will be fixed now. --- src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp | 2 +- src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp b/src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp index 2e80ead8bd..7ceb61e03f 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp @@ -643,7 +643,7 @@ TopoDS_Shape GEOMUtils::CompsolidToCompound (const TopoDS_Shape& theCompsolid) } } - return std::move(aCompound); + return TopoDS_Shape(std::move(aCompound)); } //======================================================================= diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp index 2179e8c829..12e6d23c5c 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp @@ -2100,7 +2100,7 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, } } - return std::move(aCompound); + return TopoDS_Compound(std::move(aCompound)); } //======================================================================= From fefc29b57d069dafaaafe903042a6d1ad3a8d956 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 13:43:11 +0200 Subject: [PATCH 05/46] Gui: [skip ci] Invalid signal/slot connection: 'buttonBox' -> 'Utils::CheckableMessageBox' --- src/Gui/DlgCheckableMessageBox.ui | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Gui/DlgCheckableMessageBox.ui b/src/Gui/DlgCheckableMessageBox.ui index c918eeeca4..42e0628727 100644 --- a/src/Gui/DlgCheckableMessageBox.ui +++ b/src/Gui/DlgCheckableMessageBox.ui @@ -7,7 +7,7 @@ 0 0 195 - 107 + 122 @@ -121,34 +121,34 @@ buttonBox accepted() - Utils::CheckableMessageBox + Gui::Dialog::DlgCheckableMessageBox accept() - 248 - 254 + 97 + 100 - 157 - 274 + 97 + 60 buttonBox rejected() - Utils::CheckableMessageBox + Gui::Dialog::DlgCheckableMessageBox reject() - 316 - 260 + 97 + 100 - 286 - 274 + 97 + 60 - \ No newline at end of file + From 7a8faff17d6c0b38e1ed365d3769fde09d99492c Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 13:56:57 +0200 Subject: [PATCH 06/46] Qt5: [skip ci] 'void QTextEdit::setTabStopWidth(int)' is deprecated [-Wdeprecated-declarations] --- src/Gui/DlgEditor.ui | 3 --- src/Gui/DlgEditorImp.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Gui/DlgEditor.ui b/src/Gui/DlgEditor.ui index 60906589bd..ec7fa0f33d 100644 --- a/src/Gui/DlgEditor.ui +++ b/src/Gui/DlgEditor.ui @@ -71,9 +71,6 @@ - - 40 - diff --git a/src/Gui/DlgEditorImp.cpp b/src/Gui/DlgEditorImp.cpp index 13ad497219..134985e792 100644 --- a/src/Gui/DlgEditorImp.cpp +++ b/src/Gui/DlgEditorImp.cpp @@ -61,6 +61,12 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) ui->setupUi(this); ui->EnableFolding->hide(); // Switch off until we have an editor with folding +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + ui->textEdit1->setTabStopWidth(40); +#else + ui->textEdit1->setTabStopDistance(40.0); +#endif + d = new DlgSettingsEditorP(); QColor col; col = Qt::black; From 709c349fa7c1c8a4a22bccc8b0eb20be1f33f85d Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 14:07:45 +0200 Subject: [PATCH 07/46] [skip ci] avoid to redefine GL_GLEXT_PROTOTYPES if already defined --- src/Gui/GLBuffer.cpp | 4 +++- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp | 4 +++- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Gui/GLBuffer.cpp b/src/Gui/GLBuffer.cpp index a218073730..dc6b9d617a 100644 --- a/src/Gui/GLBuffer.cpp +++ b/src/Gui/GLBuffer.cpp @@ -24,7 +24,9 @@ #include "PreCompiled.h" #ifndef FC_OS_WIN32 -#define GL_GLEXT_PROTOTYPES +# ifndef GL_GLEXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES 1 +# endif #endif #ifdef FC_OS_MACOSX diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index 7c7a7ebde8..8b0f9a5e1a 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -24,7 +24,9 @@ #include "PreCompiled.h" #ifndef FC_OS_WIN32 -#define GL_GLEXT_PROTOTYPES +# ifndef GL_GLEXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES 1 +# endif #endif #ifndef _PreComp_ diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 441a9c695a..8c0c17c977 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -23,7 +23,9 @@ #include "PreCompiled.h" #ifndef FC_OS_WIN32 -#define GL_GLEXT_PROTOTYPES +# ifndef GL_GLEXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES 1 +# endif #endif #ifndef _PreComp_ From be59c64f313f088267fcc40e08a711ba3472cee3 Mon Sep 17 00:00:00 2001 From: donovaly Date: Thu, 11 Jun 2020 18:30:21 +0200 Subject: [PATCH 08/46] [TD] detail view: add missing tooltip --- src/Mod/TechDraw/Gui/TaskDetail.ui | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/TechDraw/Gui/TaskDetail.ui b/src/Mod/TechDraw/Gui/TaskDetail.ui index ee3f9abd5d..b6fd523c4a 100644 --- a/src/Mod/TechDraw/Gui/TaskDetail.ui +++ b/src/Mod/TechDraw/Gui/TaskDetail.ui @@ -213,7 +213,7 @@ - Scale + Scale Factor @@ -259,6 +259,12 @@ + + Page: scale factor of page is used +Automatic: if the detail view is larger than the page, + it will be scaled down to fit into the page +Custom: custom scale factor is used + Page From d9981891c9664b9a16c4869119baff3f14fe418c Mon Sep 17 00:00:00 2001 From: donovaly Date: Fri, 12 Jun 2020 01:35:22 +0200 Subject: [PATCH 09/46] [TD] GeomHatch dialog: use sensible hatch limits - negative scale and line width is not sensible and lead to strange effects thus set a minimum - set the minimum reasonably above 0 since e.g. a hatch scale of 0.01 fills 8 GB RAM -> out of RAM error - disable KeyboardTracking since we don't want a time-consuming recomputation while the user changes a value --- src/Mod/TechDraw/Gui/TaskGeomHatch.ui | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/TechDraw/Gui/TaskGeomHatch.ui b/src/Mod/TechDraw/Gui/TaskGeomHatch.ui index 44e72ce644..e4c5b53573 100644 --- a/src/Mod/TechDraw/Gui/TaskGeomHatch.ui +++ b/src/Mod/TechDraw/Gui/TaskGeomHatch.ui @@ -145,6 +145,12 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false + + + 0.100000000000000 + 0.100000000000000 @@ -167,6 +173,12 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false + + + 0.001000000000000 + 0.100000000000000 From e889a49bbb6c62fa0caca4d0f2919858ace2e312 Mon Sep 17 00:00:00 2001 From: donovaly Date: Fri, 12 Jun 2020 03:04:28 +0200 Subject: [PATCH 10/46] [TD] add dialog for hatches as discussed in the forum, the hatch feature misses a dialog. So here it is. The code is more or less just the one of the existing GeomHatch dialog --- src/Mod/TechDraw/App/DrawHatch.cpp | 10 +- src/Mod/TechDraw/Gui/CMakeLists.txt | 10 +- src/Mod/TechDraw/Gui/CommandDecorate.cpp | 15 +- src/Mod/TechDraw/Gui/TaskHatch.cpp | 218 +++++++++++++++++++++ src/Mod/TechDraw/Gui/TaskHatch.h | 127 ++++++++++++ src/Mod/TechDraw/Gui/TaskHatch.ui | 163 +++++++++++++++ src/Mod/TechDraw/Gui/ViewProviderHatch.cpp | 42 ++++ src/Mod/TechDraw/Gui/ViewProviderHatch.h | 3 + 8 files changed, 579 insertions(+), 9 deletions(-) create mode 100644 src/Mod/TechDraw/Gui/TaskHatch.cpp create mode 100644 src/Mod/TechDraw/Gui/TaskHatch.h create mode 100644 src/Mod/TechDraw/Gui/TaskHatch.ui diff --git a/src/Mod/TechDraw/App/DrawHatch.cpp b/src/Mod/TechDraw/App/DrawHatch.cpp index 27b1677c7a..70c8f0e7ff 100644 --- a/src/Mod/TechDraw/App/DrawHatch.cpp +++ b/src/Mod/TechDraw/App/DrawHatch.cpp @@ -59,16 +59,16 @@ DrawHatch::DrawHatch(void) { static const char *vgroup = "Hatch"; - ADD_PROPERTY_TYPE(DirProjection ,(0,0,1.0) ,vgroup,App::Prop_None,"Projection direction when Hatch was defined"); //sb RO? - ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be hatched"); + ADD_PROPERTY_TYPE(DirProjection, (0,0,1.0), vgroup, App::Prop_None, "Projection direction when Hatch was defined"); //sb RO? + ADD_PROPERTY_TYPE(Source, (0), vgroup, (App::PropertyType)(App::Prop_None), "The View + Face to be hatched"); Source.setScope(App::LinkScope::Global); - ADD_PROPERTY_TYPE(HatchPattern ,(prefSvgHatch()),vgroup,App::Prop_None,"The hatch pattern file for this area"); + ADD_PROPERTY_TYPE(HatchPattern, (prefSvgHatch()), vgroup, App::Prop_None, "The hatch pattern file for this area"); ADD_PROPERTY_TYPE(SvgIncluded, (""), vgroup,App::Prop_None, - "Embedded Svg hatch file. System use only."); // n/a to end users + "Embedded SVG hatch file. System use only."); // n/a to end users DirProjection.setStatus(App::Property::ReadOnly,true); - std::string svgFilter("Svg files (*.svg *.SVG);;All files (*)"); + std::string svgFilter("SVG files (*.svg *.SVG);;All files (*)"); HatchPattern.setFilter(svgFilter); } diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index b48f31d31b..9ffdbfd6de 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -55,6 +55,7 @@ set(TechDrawGui_MOC_HDRS DlgTemplateField.h TaskSectionView.h TaskGeomHatch.h + TaskHatch.h TaskLeaderLine.h TaskRichAnno.h TaskCosVertex.h @@ -98,6 +99,7 @@ set(TechDrawGui_UIC_SRCS DlgTemplateField.ui TaskSectionView.ui TaskGeomHatch.ui + TaskHatch.ui TaskLeaderLine.ui TaskRichAnno.ui mrichtextedit.ui @@ -185,6 +187,9 @@ SET(TechDrawGui_SRCS TaskGeomHatch.ui TaskGeomHatch.cpp TaskGeomHatch.h + TaskHatch.ui + TaskHatch.cpp + TaskHatch.h TaskLeaderLine.ui TaskLeaderLine.cpp TaskLeaderLine.h @@ -347,10 +352,10 @@ SET(TechDrawGuiViewProvider_SRCS ViewProviderSpreadsheet.h ViewProviderViewClip.cpp ViewProviderViewClip.h - ViewProviderHatch.cpp - ViewProviderHatch.h ViewProviderGeomHatch.cpp ViewProviderGeomHatch.h + ViewProviderHatch.cpp + ViewProviderHatch.h ViewProviderImage.cpp ViewProviderImage.h ViewProviderLeader.cpp @@ -375,6 +380,7 @@ SET(TechDrawGuiTaskDlgs_SRCS TaskLinkDim.ui TaskSectionView.ui TaskGeomHatch.ui + TaskHatch.ui TaskLeaderLine.ui TaskRichAnno.ui TaskCosVertex.ui diff --git a/src/Mod/TechDraw/Gui/CommandDecorate.cpp b/src/Mod/TechDraw/Gui/CommandDecorate.cpp index a815249f6e..82e2b7036e 100644 --- a/src/Mod/TechDraw/Gui/CommandDecorate.cpp +++ b/src/Mod/TechDraw/Gui/CommandDecorate.cpp @@ -59,9 +59,11 @@ #include "DrawGuiUtil.h" #include "MDIViewPage.h" #include "TaskGeomHatch.h" +#include "TaskHatch.h" //#include "TaskLeaderLine.h" //#include "TaskRichAnno.h" #include "ViewProviderGeomHatch.h" +#include "ViewProviderHatch.h" #include "ViewProviderPage.h" using namespace TechDrawGui; @@ -281,9 +283,19 @@ void CmdTechDrawHatch::activated(int iMsg) auto hatch( static_cast(getDocument()->getObject(FeatName.c_str())) ); hatch->Source.setValue(partFeat, subNames); + Gui::ViewProvider* vp = Gui::Application::Instance->getDocument(getDocument())->getViewProvider(hatch); + TechDrawGui::ViewProviderHatch* hvp = dynamic_cast(vp); + if (!hvp) { + Base::Console().Log("ERROR - CommandDecorate - Hatch has no ViewProvider\n"); + return; + } + //should this be: doCommand(Doc,"App..Feat..Source = [(App...%s,%s),(App..%s,%s),...]",objs[0]->getNameInDocument(),subs[0],...); //seems very unwieldy + // dialog to fill in hatch values + Gui::Control().showDialog(new TaskDlgHatch(hatch, hvp, true)); + commitCommand(); //Horrible hack to force Tree update ??still required?? @@ -353,8 +365,7 @@ void CmdTechDrawGeometricHatch::activated(int iMsg) } // dialog to fill in hatch values - Gui::Control().showDialog(new TaskDlgGeomHatch(geomhatch,hvp,true)); - + Gui::Control().showDialog(new TaskDlgGeomHatch(geomhatch, hvp, true)); commitCommand(); diff --git a/src/Mod/TechDraw/Gui/TaskHatch.cpp b/src/Mod/TechDraw/Gui/TaskHatch.cpp new file mode 100644 index 0000000000..532feb9c2f --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskHatch.cpp @@ -0,0 +1,218 @@ +/*************************************************************************** + * Copyright (c) 2020 FreeCAD Developers * + * Author: Uwe Stöhr * + * * + * 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 +#endif // #ifndef _PreComp_ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "ViewProviderHatch.h" +#include "TaskHatch.h" +#include + +using namespace Gui; +using namespace TechDraw; +using namespace TechDrawGui; + +TaskHatch::TaskHatch(TechDraw::DrawHatch* inHatch, TechDrawGui::ViewProviderHatch* inVp, bool mode) : + ui(new Ui_TaskHatch), + m_hatch(inHatch), + m_Vp(inVp), + m_createMode(mode) +{ + ui->setupUi(this); + connect(ui->fcFile, SIGNAL(fileNameSelected( const QString & )), this, SLOT(onFileChanged(void))); + + m_source = m_hatch->Source.getValue(); + getParameters(); + initUi(); +} + +TaskHatch::~TaskHatch() +{ + delete ui; +} + +void TaskHatch::initUi() +{ + ui->fcFile->setFileName(QString::fromUtf8(m_file.data(), m_file.size())); + ui->sbScale->setValue(m_scale); + ui->sbScale->setSingleStep(0.1); + connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged())); + ui->ccColor->setColor(m_color.asValue()); + connect(ui->ccColor, SIGNAL(changed()), this, SLOT(onColorChanged())); +} + +//move values from screen to DocObjs +void TaskHatch::updateValues() +{ + m_file = (ui->fcFile->fileName()).toUtf8().constData(); + m_hatch->HatchPattern.setValue(m_file); + m_scale = ui->sbScale->value().getValue(); + m_Vp->HatchScale.setValue(m_scale); + m_color.setValue(ui->ccColor->color()); + m_Vp->HatchColor.setValue(m_color); +} + +QStringList TaskHatch::listToQ(std::vector in) +{ + QStringList result; + for (auto& s: in) { + QString qs = QString::fromUtf8(s.data(), s.size()); + result.append(qs); + } + return result; +} + +void TaskHatch::onFileChanged(void) +{ + m_file = ui->fcFile->fileName().toUtf8().constData(); + m_hatch->HatchPattern.setValue(m_file); + m_source->getDocument()->recompute(); +} + +bool TaskHatch::accept() +{ + updateValues(); + Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()"); + m_source->touch(); + m_source->getDocument()->recompute(); + return true; +} + +void TaskHatch::onScaleChanged() +{ + m_Vp->HatchScale.setValue(ui->sbScale->value().getValue()); + m_source->getDocument()->recompute(); +} + +void TaskHatch::onColorChanged() +{ + App::Color ac; + ac.setValue(ui->ccColor->color()); + m_Vp->HatchColor.setValue(ac); + m_source->getDocument()->recompute(); +} + +bool TaskHatch::reject() +{ + if (getCreateMode()) { + std::string HatchName = m_hatch->getNameInDocument(); + Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().removeObject('%s')",HatchName.c_str()); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()"); + m_source->touch(); + m_source->getDocument()->recompute(); + } else { + m_hatch->HatchPattern.setValue(m_origFile); + m_Vp->HatchScale.setValue(m_origScale); + m_Vp->HatchColor.setValue(m_origColor); + } + return false; +} + +void TaskHatch::getParameters() +{ + m_file = m_hatch->HatchPattern.getValue(); + m_scale = m_Vp->HatchScale.getValue(); + m_color = m_Vp->HatchColor.getValue(); + if (!getCreateMode()) { + m_origFile = m_hatch->HatchPattern.getValue(); + m_origScale = m_Vp->HatchScale.getValue(); + m_origColor = m_Vp->HatchColor.getValue(); + } +} + +void TaskHatch::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +TaskDlgHatch::TaskDlgHatch(TechDraw::DrawHatch* inHatch, TechDrawGui::ViewProviderHatch* inVp, bool mode) : + TaskDialog(), + viewProvider(nullptr) +{ + widget = new TaskHatch(inHatch, inVp, mode); + taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("TechDraw_Tree_View"), + widget->windowTitle(), true, 0); + taskbox->groupLayout()->addWidget(widget); + Content.push_back(taskbox); +} + +TaskDlgHatch::~TaskDlgHatch() +{ +} + +void TaskDlgHatch::setCreateMode(bool b) +{ + widget->setCreateMode(b); +} + +void TaskDlgHatch::update() +{ + //widget->updateTask(); +} + +//==== calls from the TaskView =============================================================== +void TaskDlgHatch::open() +{ +} + +void TaskDlgHatch::clicked(int i) +{ + Q_UNUSED(i); +} + +bool TaskDlgHatch::accept() +{ + widget->accept(); + return true; +} + +bool TaskDlgHatch::reject() +{ + widget->reject(); + return true; +} + +#include diff --git a/src/Mod/TechDraw/Gui/TaskHatch.h b/src/Mod/TechDraw/Gui/TaskHatch.h new file mode 100644 index 0000000000..e541f0ff9c --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskHatch.h @@ -0,0 +1,127 @@ +/*************************************************************************** + * Copyright (c) 2020 FreeCAD Developers * + * Author: Uwe Stöhr * + * * + * 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 GUI_TASKVIEW_TASKHATCH_H +#define GUI_TASKVIEW_TASKHATCH_H + +#include +#include +#include + +#include +#include + + +class Ui_TaskHatch; + +namespace App +{ +class DocumentObject; +} + +namespace TechDrawGui +{ +class ViewProviderHatch; + +class TaskHatch : public QWidget +{ + Q_OBJECT + +public: + TaskHatch(TechDraw::DrawHatch* inHatch,TechDrawGui::ViewProviderHatch* inVp, bool mode); + ~TaskHatch(); + +public: + virtual bool accept(); + virtual bool reject(); + void setCreateMode(bool b) { m_createMode = b;} + bool getCreateMode() { return m_createMode; } + +protected Q_SLOTS: + void onFileChanged(void); + +protected: + void changeEvent(QEvent *e); + void initUi(); +// bool resetUi(); + void updateValues(); + void getParameters(); + QStringList listToQ(std::vector in); + +private Q_SLOTS: + void onScaleChanged(); + void onColorChanged(); + +private: + Ui_TaskHatch * ui; + TechDraw::DrawHatch* m_hatch; + TechDrawGui::ViewProviderHatch* m_Vp; + App::DocumentObject* m_source; + std::string m_file; + double m_scale; + App::Color m_color; + std::string m_origFile; + double m_origScale; + App::Color m_origColor; + + bool m_createMode; + +}; + +class TaskDlgHatch : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgHatch(TechDraw::DrawHatch* inHatch,TechDrawGui::ViewProviderHatch* inVp, bool mode); + ~TaskDlgHatch(); + const ViewProviderHatch * getViewProvider() const { return viewProvider; } + +public: + /// is called the TaskView when the dialog is opened + virtual void open(); + /// is called by the framework if an button is clicked which has no accept or reject role + virtual void clicked(int); + /// is called by the framework if the dialog is accepted (Ok) + virtual bool accept(); + /// is called by the framework if the dialog is rejected (Cancel) + virtual bool reject(); + /// is called by the framework if the user presses the help button + virtual void helpRequested() { return;} + virtual bool isAllowedAlterDocument(void) const + { return false; } + void setCreateMode(bool b); + + void update(); + +protected: + const ViewProviderHatch *viewProvider; + +private: + TaskHatch * widget; + Gui::TaskView::TaskBox* taskbox; +}; + +} //namespace TechDrawGui + +#endif // #ifndef GUI_TASKVIEW_TASKHATCH_H diff --git a/src/Mod/TechDraw/Gui/TaskHatch.ui b/src/Mod/TechDraw/Gui/TaskHatch.ui new file mode 100644 index 0000000000..bf309de485 --- /dev/null +++ b/src/Mod/TechDraw/Gui/TaskHatch.ui @@ -0,0 +1,163 @@ + + + TechDrawGui::TaskHatch + + + + 0 + 0 + 342 + 135 + + + + + 0 + 0 + + + + + 250 + 0 + + + + Apply Hatch to Face + + + + + + + 0 + 0 + + + + Define your pattern + + + + + + + + + 0 + 0 + + + + The PAT file containing your pattern + + + + + + + Pattern File + + + + + + + + + + + + 0 + 22 + + + + Color of pattern lines + + + + + + + Line Color + + + + + + + + 0 + 22 + + + + Enlarges/shrinks the pattern + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + 0.001000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Pattern Scale + + + + + + + + + + + + + Gui::FileChooser + QWidget +
Gui/FileDialog.h
+
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+ + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+
+ + + + +
diff --git a/src/Mod/TechDraw/Gui/ViewProviderHatch.cpp b/src/Mod/TechDraw/Gui/ViewProviderHatch.cpp index 1085e0f6c7..09aeba1fd8 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderHatch.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderHatch.cpp @@ -37,9 +37,12 @@ #include #include #include +#include #include #include + +#include "TaskHatch.h" #include "ViewProviderHatch.h" using namespace TechDrawGui; @@ -93,6 +96,45 @@ std::vector ViewProviderHatch::getDisplayModes(void) const return StrList; } +bool ViewProviderHatch::setEdit(int ModNum) +{ + Q_UNUSED(ModNum); + Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); + TaskDlgHatch *projDlg = qobject_cast(dlg); + if (projDlg && (projDlg->getViewProvider() != this)) + projDlg = 0; // somebody left task panel open + + // clear the selection (convenience) + Gui::Selection().clearSelection(); + + // start the edit dialog + if (projDlg) { + projDlg->setCreateMode(false); + Gui::Control().showDialog(projDlg); + } + else { + Gui::Control().showDialog(new TaskDlgHatch(getViewObject(), this, false)); + } + + return true; +} + +void ViewProviderHatch::unsetEdit(int ModNum) +{ + if (ModNum == ViewProvider::Default) { + Gui::Control().closeDialog(); + } + else { + ViewProviderDocumentObject::unsetEdit(ModNum); + } +} + +bool ViewProviderHatch::doubleClicked(void) +{ + setEdit(0); + return true; +} + void ViewProviderHatch::onChanged(const App::Property* prop) { if ((prop == &HatchScale) || diff --git a/src/Mod/TechDraw/Gui/ViewProviderHatch.h b/src/Mod/TechDraw/Gui/ViewProviderHatch.h index 83d24984aa..07062c0107 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderHatch.h +++ b/src/Mod/TechDraw/Gui/ViewProviderHatch.h @@ -53,6 +53,9 @@ public: /// returns a list of all possible modes virtual std::vector getDisplayModes(void) const override; virtual void onChanged(const App::Property* prop) override; + virtual bool setEdit(int ModNum) override; + virtual void unsetEdit(int ModNum) override; + virtual bool doubleClicked(void) override; virtual void updateData(const App::Property*) override; virtual bool canDelete(App::DocumentObject* obj) const override; From 7bba15a2c9dcbe435883537ac2ce9d9561c353b5 Mon Sep 17 00:00:00 2001 From: donovaly Date: Fri, 12 Jun 2020 03:42:29 +0200 Subject: [PATCH 11/46] [TD] make all hatch patters plain SVG - everything that is part of the drawing should be plain SVG (strictly following the SVG specification) to assure that every SVG program can handle it (e.g. Internet browsers). The hatch patterns however contained old stuff like traces of Sodipodi that might be a problem in the future. --- src/Mod/TechDraw/Patterns/aluminium.svg | 63 +- src/Mod/TechDraw/Patterns/brick01.svg | 211 +--- src/Mod/TechDraw/Patterns/concrete.svg | 221 +--- src/Mod/TechDraw/Patterns/cross.svg | 162 +-- src/Mod/TechDraw/Patterns/cuprous.svg | 151 ++- src/Mod/TechDraw/Patterns/diagonal1.svg | 461 ++------ src/Mod/TechDraw/Patterns/diagonal2.svg | 461 ++------ src/Mod/TechDraw/Patterns/earth.svg | 163 +-- src/Mod/TechDraw/Patterns/general_steel.svg | 54 +- src/Mod/TechDraw/Patterns/glass.svg | 194 ++-- src/Mod/TechDraw/Patterns/hatch45L.svg | 117 +-- src/Mod/TechDraw/Patterns/hatch45R.svg | 117 +-- src/Mod/TechDraw/Patterns/hbone.svg | 399 ++----- src/Mod/TechDraw/Patterns/line.svg | 98 +- src/Mod/TechDraw/Patterns/plastic.svg | 94 +- src/Mod/TechDraw/Patterns/plus.svg | 147 +-- src/Mod/TechDraw/Patterns/simple.svg | 115 +- src/Mod/TechDraw/Patterns/solid.svg | 90 +- src/Mod/TechDraw/Patterns/square.svg | 126 +-- src/Mod/TechDraw/Patterns/steel.svg | 282 +---- src/Mod/TechDraw/Patterns/titanium.svg | 143 ++- src/Mod/TechDraw/Patterns/wood.svg | 1049 +++---------------- src/Mod/TechDraw/Patterns/woodgrain.svg | 166 +-- src/Mod/TechDraw/Patterns/zinc.svg | 70 +- 24 files changed, 989 insertions(+), 4165 deletions(-) diff --git a/src/Mod/TechDraw/Patterns/aluminium.svg b/src/Mod/TechDraw/Patterns/aluminium.svg index c4c96500a4..6a69bc41e1 100644 --- a/src/Mod/TechDraw/Patterns/aluminium.svg +++ b/src/Mod/TechDraw/Patterns/aluminium.svg @@ -1,35 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/brick01.svg b/src/Mod/TechDraw/Patterns/brick01.svg index 3ce8edcf72..b5d768e3ec 100644 --- a/src/Mod/TechDraw/Patterns/brick01.svg +++ b/src/Mod/TechDraw/Patterns/brick01.svg @@ -1,137 +1,37 @@ - - - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + - + image/svg+xml - - + + Pablo Gil @@ -146,61 +46,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/concrete.svg b/src/Mod/TechDraw/Patterns/concrete.svg index b919a036c8..00fa86db9b 100644 --- a/src/Mod/TechDraw/Patterns/concrete.svg +++ b/src/Mod/TechDraw/Patterns/concrete.svg @@ -1,191 +1,52 @@ - - + + - + image/svg+xml - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/cross.svg b/src/Mod/TechDraw/Patterns/cross.svg index e77cf8d73f..ad1937d347 100644 --- a/src/Mod/TechDraw/Patterns/cross.svg +++ b/src/Mod/TechDraw/Patterns/cross.svg @@ -1,148 +1,34 @@ - - + + - + image/svg+xml - + + - - - - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/cuprous.svg b/src/Mod/TechDraw/Patterns/cuprous.svg index 0447c7c004..ce82701755 100644 --- a/src/Mod/TechDraw/Patterns/cuprous.svg +++ b/src/Mod/TechDraw/Patterns/cuprous.svg @@ -1,79 +1,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/diagonal1.svg b/src/Mod/TechDraw/Patterns/diagonal1.svg index 4950ead90b..16360a8d7a 100644 --- a/src/Mod/TechDraw/Patterns/diagonal1.svg +++ b/src/Mod/TechDraw/Patterns/diagonal1.svg @@ -1,79 +1,11 @@ - - - - - - + + + - + image/svg+xml - + @@ -89,324 +21,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/diagonal2.svg b/src/Mod/TechDraw/Patterns/diagonal2.svg index 1a96fd7e7f..9061a99a48 100644 --- a/src/Mod/TechDraw/Patterns/diagonal2.svg +++ b/src/Mod/TechDraw/Patterns/diagonal2.svg @@ -1,79 +1,11 @@ - - - - - - + + + - + image/svg+xml - + @@ -89,324 +21,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/earth.svg b/src/Mod/TechDraw/Patterns/earth.svg index 8ede57ed0e..800d524cc7 100644 --- a/src/Mod/TechDraw/Patterns/earth.svg +++ b/src/Mod/TechDraw/Patterns/earth.svg @@ -1,87 +1,11 @@ - - - - - - - - + + + - + image/svg+xml - + @@ -97,69 +21,18 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/general_steel.svg b/src/Mod/TechDraw/Patterns/general_steel.svg index 13d93b88ca..37f18cab5e 100644 --- a/src/Mod/TechDraw/Patterns/general_steel.svg +++ b/src/Mod/TechDraw/Patterns/general_steel.svg @@ -1,32 +1,24 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/glass.svg b/src/Mod/TechDraw/Patterns/glass.svg index 7f8774dcbe..00828defaf 100644 --- a/src/Mod/TechDraw/Patterns/glass.svg +++ b/src/Mod/TechDraw/Patterns/glass.svg @@ -1,101 +1,95 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/hatch45L.svg b/src/Mod/TechDraw/Patterns/hatch45L.svg index 302041d5c9..d3ae57a080 100644 --- a/src/Mod/TechDraw/Patterns/hatch45L.svg +++ b/src/Mod/TechDraw/Patterns/hatch45L.svg @@ -1,113 +1,26 @@ - - + + - + image/svg+xml - + - - - - - - - + + + + - - - - - - - + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/hatch45R.svg b/src/Mod/TechDraw/Patterns/hatch45R.svg index b8f554da94..3983be0c28 100644 --- a/src/Mod/TechDraw/Patterns/hatch45R.svg +++ b/src/Mod/TechDraw/Patterns/hatch45R.svg @@ -1,113 +1,26 @@ - - + + - + image/svg+xml - + - - - - - - - + + + + - - - - - - - + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/hbone.svg b/src/Mod/TechDraw/Patterns/hbone.svg index 7c904495d3..7e9a9ddf16 100644 --- a/src/Mod/TechDraw/Patterns/hbone.svg +++ b/src/Mod/TechDraw/Patterns/hbone.svg @@ -1,318 +1,135 @@ - - - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + - + image/svg+xml - + @@ -328,40 +145,12 @@ - - - - - - - + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/line.svg b/src/Mod/TechDraw/Patterns/line.svg index ecc47cf3d0..24c660cd36 100644 --- a/src/Mod/TechDraw/Patterns/line.svg +++ b/src/Mod/TechDraw/Patterns/line.svg @@ -1,95 +1,23 @@ - - + + - + image/svg+xml - + + - - - - - - - + + + + - - - - + + + + diff --git a/src/Mod/TechDraw/Patterns/plastic.svg b/src/Mod/TechDraw/Patterns/plastic.svg index 1bf2c69ccf..05d4343f5d 100644 --- a/src/Mod/TechDraw/Patterns/plastic.svg +++ b/src/Mod/TechDraw/Patterns/plastic.svg @@ -1,67 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/plus.svg b/src/Mod/TechDraw/Patterns/plus.svg index 2ea4c15a72..2842c14b52 100644 --- a/src/Mod/TechDraw/Patterns/plus.svg +++ b/src/Mod/TechDraw/Patterns/plus.svg @@ -1,87 +1,11 @@ - - - - - - - - + + + - + image/svg+xml - + @@ -97,57 +21,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/simple.svg b/src/Mod/TechDraw/Patterns/simple.svg index 07b0da6af3..3dabba0eef 100644 --- a/src/Mod/TechDraw/Patterns/simple.svg +++ b/src/Mod/TechDraw/Patterns/simple.svg @@ -1,111 +1,26 @@ - - + + - + image/svg+xml - + - - - - - - - + + + + - - - - - - - + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/solid.svg b/src/Mod/TechDraw/Patterns/solid.svg index b70303a0f8..1196ffcb2e 100644 --- a/src/Mod/TechDraw/Patterns/solid.svg +++ b/src/Mod/TechDraw/Patterns/solid.svg @@ -1,79 +1,11 @@ - - - - - - + + + - + image/svg+xml - + @@ -89,15 +21,7 @@ - - + + diff --git a/src/Mod/TechDraw/Patterns/square.svg b/src/Mod/TechDraw/Patterns/square.svg index 8cd2b7ff6a..4c77b1f1d6 100644 --- a/src/Mod/TechDraw/Patterns/square.svg +++ b/src/Mod/TechDraw/Patterns/square.svg @@ -1,118 +1,28 @@ - - + + - + image/svg+xml - + + - - - - - - - - + + + + + - - - - - - - - + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/steel.svg b/src/Mod/TechDraw/Patterns/steel.svg index 4da18b8778..b9ded695a0 100644 --- a/src/Mod/TechDraw/Patterns/steel.svg +++ b/src/Mod/TechDraw/Patterns/steel.svg @@ -1,86 +1,11 @@ - - - - - - - - + + + - + image/svg+xml - + @@ -96,169 +21,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/titanium.svg b/src/Mod/TechDraw/Patterns/titanium.svg index 8ddcba2e5f..c450f1a080 100644 --- a/src/Mod/TechDraw/Patterns/titanium.svg +++ b/src/Mod/TechDraw/Patterns/titanium.svg @@ -1,75 +1,70 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/wood.svg b/src/Mod/TechDraw/Patterns/wood.svg index 85e3b09518..68d5bc8f5d 100644 --- a/src/Mod/TechDraw/Patterns/wood.svg +++ b/src/Mod/TechDraw/Patterns/wood.svg @@ -1,926 +1,145 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + image/svg+xml - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/woodgrain.svg b/src/Mod/TechDraw/Patterns/woodgrain.svg index 6228d83c8e..3af7f8d588 100644 --- a/src/Mod/TechDraw/Patterns/woodgrain.svg +++ b/src/Mod/TechDraw/Patterns/woodgrain.svg @@ -1,154 +1,36 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - + - + image/svg+xml - + - - - - - - - - - + + + + + + + + + diff --git a/src/Mod/TechDraw/Patterns/zinc.svg b/src/Mod/TechDraw/Patterns/zinc.svg index 316ac9a8c5..d4b6846755 100644 --- a/src/Mod/TechDraw/Patterns/zinc.svg +++ b/src/Mod/TechDraw/Patterns/zinc.svg @@ -1,39 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + From fa219743d01e7dee3298e4b7a0989ac04c1de033 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 12 Jun 2020 14:22:39 +0200 Subject: [PATCH 12/46] Arch: Better support for App::Parts in Arch Windows --- src/Mod/Arch/Arch.py | 1 + src/Mod/Arch/ArchComponent.py | 134 +++---- src/Mod/Arch/ArchWindow.py | 599 +++++------------------------- src/Mod/Arch/ArchWindowPresets.py | 487 ++++++++++++++++++++++++ src/Mod/Arch/CMakeLists.txt | 1 + 5 files changed, 647 insertions(+), 575 deletions(-) create mode 100644 src/Mod/Arch/ArchWindowPresets.py diff --git a/src/Mod/Arch/Arch.py b/src/Mod/Arch/Arch.py index 99216f7598..05890af2d4 100644 --- a/src/Mod/Arch/Arch.py +++ b/src/Mod/Arch/Arch.py @@ -49,6 +49,7 @@ from ArchProfile import * from ArchCommands import * from ArchSectionPlane import * from ArchWindow import * +from ArchWindowPresets import * from ArchAxis import * from ArchRoof import * from ArchSpace import * diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index bea21f3c07..e6b9079365 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -172,7 +172,7 @@ class Component(ArchIFC.IfcProduct): ---------- obj: The object to turn into an Arch Component - """ + """ def __init__(self, obj): obj.Proxy = self @@ -275,7 +275,7 @@ class Component(ArchIFC.IfcProduct): return None def onBeforeChange(self,obj,prop): - """Method called before the object has a property changed. + """Method called before the object has a property changed. Specifically, this method is called before the value changes. @@ -392,7 +392,7 @@ class Component(ArchIFC.IfcProduct): The Height value of the found Floor or BuildingPart. """ - + for parent in obj.InList: if Draft.getType(parent) in ["Floor","BuildingPart"]: if obj in parent.Group: @@ -476,7 +476,7 @@ class Component(ArchIFC.IfcProduct): Recursively scrape the Bases of the object, until a Base that is derived from a is found. From there, copy the - extrusion to the (0,0,0) origin. + extrusion to the (0,0,0) origin. With this copy, get the the shape was originally extruded from, the of the extrusion, and the @@ -645,7 +645,7 @@ class Component(ArchIFC.IfcProduct): """Hides Additions and Subtractions of this Component when that list changes. Intended to be used in conjunction with the .onChanged() method, to - access the property that has changed. + access the property that has changed. When an object loses or gains an Addition, this method hides all Additions. When it gains or loses a Subtraction, this method hides all @@ -697,7 +697,7 @@ class Component(ArchIFC.IfcProduct): The base shape to add Additions and Subtractions to. placement: , optional Prior to adding or subtracting subshapes, the of - the subshapes are multiplied by the inverse of this parameter. + the subshapes are multiplied by the inverse of this parameter. Returns ------- @@ -753,41 +753,44 @@ class Component(ArchIFC.IfcProduct): # treat subtractions subs = obj.Subtractions - for link in obj.InList: + for link in obj.InListRecursive: if hasattr(link,"Hosts"): for host in link.Hosts: if host == obj: subs.append(link) + elif hasattr(link,"Host"): + if link.Host == obj: + subs.append(link) for o in subs: - if base: if base.isNull(): base = None if base: + subvolume = None if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window",True)): # windows can be additions or subtractions, treated the same way - f = o.Proxy.getSubVolume(o) - if f: - if base.Solids and f.Solids: - if placement: - f.Placement = f.Placement.multiply(placement) - if len(base.Solids) > 1: - base = Part.makeCompound([sol.cut(f) for sol in base.Solids]) - else: - base = base.cut(f) - + subvolume = o.Proxy.getSubVolume(o) elif (Draft.getType(o) == "Roof") or (Draft.isClone(o,"Roof")): # roofs define their own special subtraction volume - f = o.Proxy.getSubVolume(o) - if f: - if base.Solids and f.Solids: - if len(base.Solids) > 1: - base = Part.makeCompound([sol.cut(f) for sol in base.Solids]) - else: - base = base.cut(f) + subvolume = o.Proxy.getSubVolume(o) + elif hasattr(o,"Subvolume") and hasattr(o.Subvolume,"Shape"): + # Any other object with a Subvolume property + subvolume = o.Subvolume.Shape.copy() + if hasattr(o,"Placement"): + subvolume.Placement = subvolume.Placement.multiply(o.Placement) + + if subvolume: + if base.Solids and subvolume.Solids: + if placement: + subvolume.Placement = subvolume.Placement.multiply(placement) + if len(base.Solids) > 1: + base = Part.makeCompound([sol.cut(subvolume) for sol in base.Solids]) + else: + base = base.cut(subvolume) elif hasattr(o,'Shape'): + # no subvolume, we subtract the whole shape if o.Shape: if not o.Shape.isNull(): if o.Shape.Solids and base.Solids: @@ -941,7 +944,7 @@ class Component(ArchIFC.IfcProduct): """Compute the area properties of the object's shape. Compute the vertical area, horizontal area, and perimeter length of - the object's shape. + the object's shape. The vertical area is the surface area of the faces perpendicular to the ground. @@ -1101,6 +1104,30 @@ class Component(ArchIFC.IfcProduct): # - must have an IfcWindowType and IfcRelFillsElement (to be implemented in IFC exporter) return False + def getHosts(self,obj): + """Return the objects that have this one as host, + that is, objects with a "Host" property pointing + at this object, or a "Hosts" property containing + this one. + + Returns + ------- + list of + The Arch Structures hosting this component. + """ + + hosts = [] + for link in obj.InListRecursive: + if hasattr(link,"Host"): + if link.Host: + if link.Host == obj: + hosts.append(link) + elif hasattr(link,"Hosts"): + for host in link.Hosts: + if host == obj: + hosts.append(link) + return hosts + class ViewProviderComponent: """A default View Provider for Component objects. @@ -1112,13 +1139,13 @@ class ViewProviderComponent: ---------- vobj: The view provider to turn into a component view provider. - """ + """ def __init__(self,vobj): vobj.Proxy = self self.Object = vobj.Object self.setProperties(vobj) - + def setProperties(self,vobj): """Give the component view provider its component view provider specific properties. @@ -1242,7 +1269,7 @@ class ViewProviderComponent: d = vobj.DiffuseColor vobj.DiffuseColor = d elif prop == "Visibility": - for host in self.getHosts(): + for host in vobj.Object.Proxy.getHosts(vobj.Object): if hasattr(host, 'ViewObject'): host.ViewObject.Visibility = vobj.Visibility @@ -1252,7 +1279,7 @@ class ViewProviderComponent: """Add display modes' data to the coin scenegraph. Add each display mode as a coin node, whose parent is this view - provider. + provider. Each display mode's node includes the data needed to display the object in that mode. This might include colors of faces, or the draw style of @@ -1304,7 +1331,7 @@ class ViewProviderComponent: When HiRes is set as display mode, display the component as a copy of the mesh associated as the HiRes property of the host object. See - ArchComponent.Component's properties. + ArchComponent.Component's properties. If no shape is set in the HiRes property, just display the object as the Flat Lines display mode. @@ -1414,8 +1441,9 @@ class ViewProviderComponent: objlink = getattr(self.Object,link) if objlink: c.append(objlink) - for link in self.getHosts(): - c.append(link) + if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("ClaimHosted",True): + for link in self.Object.Proxy.getHosts(self.Object): + c.append(link) return c return [] @@ -1527,39 +1555,11 @@ class ViewProviderComponent: """ if obj.CloneOf: - if (self.areDifferentColors(obj.ViewObject.DiffuseColor, - obj.CloneOf.ViewObject.DiffuseColor) + if (self.areDifferentColors(obj.ViewObject.DiffuseColor, + obj.CloneOf.ViewObject.DiffuseColor) or force): obj.ViewObject.DiffuseColor = obj.CloneOf.ViewObject.DiffuseColor - - def getHosts(self): - """Return the hosts of the view provider's host object. - - Note that in this case, the hosts are the objects referenced by Arch - Rebar's "Host" and/or "Hosts" properties specifically. Only Arch Rebar - has these properties. - - Returns - ------- - list of - The Arch Structures hosting this component. - """ - - hosts = [] - - if hasattr(self,"Object"): - for link in self.Object.InList: - if hasattr(link,"Host"): - if link.Host: - if link.Host == self.Object: - hosts.append(link) - elif hasattr(link,"Hosts"): - for host in link.Hosts: - if host == self.Object: - hosts.append(link) - - return hosts class ArchSelectionObserver: @@ -1660,7 +1660,7 @@ class SelectionTaskPanel: def reject(self): """The method run when the user selects the cancel button.""" - + if hasattr(FreeCAD,"ArchObserver"): FreeCADGui.Selection.removeObserver(FreeCAD.ArchObserver) del FreeCAD.ArchObserver @@ -2062,7 +2062,7 @@ class ComponentTaskPanel: def acceptIfcProperties(self): """This method runs as a callback when the user selects the ok button in the IFC editor. - + Scrape through the rows of the IFC editor's items, and compare them to the object being edited's .IfcData. If the two are different, change the object's .IfcData to match the editor's items. @@ -2159,7 +2159,7 @@ class ComponentTaskPanel: def addIfcPset(self,idx=0): """Add an IFC property set to the object, within the IFC editor. - + This method runs as a callback when the user selects a property set within the Add property set dropdown. @@ -2265,7 +2265,7 @@ if FreeCAD.GuiUp: ---------- parent: The table cell that is being edited. - option: + option: Unused? index: The index object of the table of the IFC editor. diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index a3051e6661..4f64a65f8c 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -22,6 +22,7 @@ import os import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands +import ArchWindowPresets from FreeCAD import Units from FreeCAD import Vector if FreeCAD.GuiUp: @@ -54,11 +55,9 @@ __url__ = "http://www.freecadweb.org" # presets WindowPartTypes = ["Frame","Solid panel","Glass panel","Louvre"] AllowedHosts = ["Wall","Structure","Roof"] -WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane", - "Sliding 2-pane", "Simple door", "Glass door", "Sliding 4-pane"] WindowOpeningModes = ["None","Arc 90","Arc 90 inv","Arc 45","Arc 45 inv","Arc 180", "Arc 180 inv","Triangle","Triangle inv","Sliding","Sliding inv"] - +WindowPresets = ArchWindowPresets.WindowPresets def makeWindow(baseobj=None,width=None,height=None,parts=None,name="Window"): @@ -101,6 +100,13 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name="Window"): ws += "Wire" + str(i) i += 1 obj.WindowParts = ["Default","Frame",ws,"1","0"] + else: + # bind properties from base obj if existing + for prop in ["Height","Width","Subvolume","Tag","Description","Material"]: + for p in baseobj.PropertiesList: + if (p == prop) or p.endswith("_"+prop): + obj.setExpression(prop, baseobj.Name+"."+p) + if obj.Base and FreeCAD.GuiUp: obj.Base.ViewObject.DisplayMode = "Wireframe" obj.Base.ViewObject.hide() @@ -108,475 +114,26 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name="Window"): todo.delay(recolorize,[obj.Document.Name,obj.Name]) return obj -def recolorize(names): # names is [docname,objname] +def recolorize(attr): # names is [docname,objname] - if names[0] in FreeCAD.listDocuments(): - doc = FreeCAD.getDocument(names[0]) - obj = doc.getObject(names[1]) - if obj: - if obj.ViewObject: - if obj.ViewObject.Proxy: - obj.ViewObject.Proxy.colorize(obj,force=True) + """Recolorizes an object or a [documentname,objectname] list + This basically calls the Proxy.colorize(obj) methods of objects that + have one.""" -def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None): + if isinstance(attr,list): + if attr[0] in FreeCAD.listDocuments(): + doc = FreeCAD.getDocument(attr[0]) + obj = doc.getObject(attr[1]) + if obj: + if obj.ViewObject: + if obj.ViewObject.Proxy: + obj.ViewObject.Proxy.colorize(obj,force=True) + elif hasattr(attr,"ViewObject") and attr.ViewObject: + obj = attr + if hasattr(obj.ViewObject,"Proxy") and hasattr(obj.ViewObject.Proxy,"colorize"): + obj.ViewObject.Proxy.colorize(obj,force=True) - """makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,[placement]): makes a - window object based on the given data. windowtype must be one of the names - defined in Arch.WindowPresets""" - if not FreeCAD.ActiveDocument: - FreeCAD.Console.PrintError("No active document. Aborting\n") - return - - def makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2): - - import Part,Sketcher - width = float(width) - height = float(height) - h1 = float(h1) - h2 = float(h2) - h3 = float(h3) - w1 = float(w1) - w2 = float(w2) - o1 = float(o1) - o2 = float(o2) - # small spacing to avoid wrong auto-wires in sketch - tol = h1/10 - # glass size divider - gla = 10 - s = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch') - - def addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8): - - "adds two rectangles to the given sketch" - - idx = s.GeometryCount - s.addGeometry(Part.LineSegment(p1,p2)) - s.addGeometry(Part.LineSegment(p2,p3)) - s.addGeometry(Part.LineSegment(p3,p4)) - s.addGeometry(Part.LineSegment(p4,p1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx,2,idx+1,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+1,2,idx+2,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+2,2,idx+3,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+3,2,idx,1)) - s.addConstraint(Sketcher.Constraint('Horizontal',idx)) - s.addConstraint(Sketcher.Constraint('Horizontal',idx+2)) - s.addConstraint(Sketcher.Constraint('Vertical',idx+1)) - s.addConstraint(Sketcher.Constraint('Vertical',idx+3)) - s.addGeometry(Part.LineSegment(p5,p6)) - s.addGeometry(Part.LineSegment(p6,p7)) - s.addGeometry(Part.LineSegment(p7,p8)) - s.addGeometry(Part.LineSegment(p8,p5)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+4,2,idx+5,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+5,2,idx+6,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+6,2,idx+7,1)) - s.addConstraint(Sketcher.Constraint('Coincident',idx+7,2,idx+4,1)) - s.addConstraint(Sketcher.Constraint('Horizontal',idx+4)) - s.addConstraint(Sketcher.Constraint('Horizontal',idx+6)) - s.addConstraint(Sketcher.Constraint('Vertical',idx+5)) - s.addConstraint(Sketcher.Constraint('Vertical',idx+7)) - - def outerFrame(s,width,height,h1,w1,o1): - - p1 = Vector(0,0,0) - p2 = Vector(width,0,0) - p3 = Vector(width,height,0) - p4 = Vector(0,height,0) - p5 = Vector(h1,h1,0) - p6 = Vector(width-h1,h1,0) - p7 = Vector(width-h1,height-h1,0) - p8 = Vector(h1,height-h1,0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16 - s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17 - s.renameConstraint(16, 'Height') - s.renameConstraint(17, 'Width') - s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,h1)) - s.renameConstraint(18, 'Frame1') - s.renameConstraint(19, 'Frame2') - s.renameConstraint(20, 'Frame3') - s.renameConstraint(21, 'Frame4') - s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1)) - return ["OuterFrame","Frame","Wire0,Wire1",str(w1-w2)+"+V","0.00+V"] - - def doorFrame(s,width,height,h1,w1,o1): - - p1 = Vector(0,0,0) - p2 = Vector(width,0,0) - p3 = Vector(width,height,0) - p4 = Vector(0,height,0) - p5 = Vector(h1,0,0) - p6 = Vector(width-h1,0,0) - p7 = Vector(width-h1,height-h1,0) - p8 = Vector(h1,height-h1,0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16 - s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17 - s.renameConstraint(16, 'Height') - s.renameConstraint(17, 'Width') - s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1)) - s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,0.0)) - s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1)) - s.renameConstraint(18, 'Frame1') - s.renameConstraint(19, 'Frame2') - s.renameConstraint(20, 'Frame3') - return ["OuterFrame","Frame","Wire0,Wire1",str(w1-w2)+"+V","0.00+V"] - - if windowtype == "Fixed": - - wp = outerFrame(s,width,height,h1,w1,o1) - wp.extend(["Glass","Glass panel","Wire1",str(w1/gla),str(w1/2)+"+V"]) - - elif windowtype == "Open 1-pane": - - wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) - if h2 == h1: - s.renameConstraint(39,'Frame5') - s.renameConstraint(40,'Frame6') - s.renameConstraint(42,'Frame7') - s.renameConstraint(41,'Frame8') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) - wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) - - elif windowtype == "Open 2-pane": - - wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector((width/2)-tol,h1+tol,0) - p3 = Vector((width/2)-tol,height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector((width/2)-h2,h1+h2,0) - p7 = Vector((width/2)-h2,height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector((width/2)+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector((width/2)+tol,height-(h1+tol),0) - p5 = Vector((width/2)+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector((width/2)+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('Equal',22,14)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol)) - s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22)) - s.addConstraint(Sketcher.Constraint('PointOnObject',20,1,12)) - if h1 == h2: - s.renameConstraint(55,'Frame5') - s.renameConstraint(56,'Frame6') - s.renameConstraint(57,'Frame7') - s.renameConstraint(58,'Frame8') - s.renameConstraint(59,'Frame9') - s.renameConstraint(60,'Frame10') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["LeftFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) - wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) - wp.extend(["RightFrame","Frame","Wire4,Wire5",fw,str(o2)+"+V"]) - wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2/2)+"+V"]) - - elif windowtype == "Sash 2-pane": - - wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),(height/2)-tol,0) - p4 = Vector(h1+tol,(height/2)-tol,0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),(height/2)-h2,0) - p8 = Vector(h1+h2,(height/2)-h2,0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector(h1+tol,(height/2)+tol,0) - p2 = Vector(width-(h1+tol),(height/2)+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,(height/2)+h2,0) - p6 = Vector(width-(h1+h2),(height/2)+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',16,2,20,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,2,14,2,-h2)) - s.addConstraint(Sketcher.Constraint('Equal',23,15)) - s.addConstraint(Sketcher.Constraint('DistanceX',12,1,20,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceX',13,2,20,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,16,1,tol)) - s.addConstraint(Sketcher.Constraint('PointOnObject',9,2,17)) - s.addConstraint(Sketcher.Constraint('PointOnObject',16,1,11)) - if h1 == h2: - s.renameConstraint(55,'Frame5') - s.renameConstraint(56,'Frame6') - s.renameConstraint(57,'Frame7') - s.renameConstraint(58,'Frame8') - s.renameConstraint(59,'Frame9') - s.renameConstraint(60,'F10') - s.setExpression('.Constraints.F10','-.Constraints.Frame5') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["LowerFrame","Frame","Wire2,Wire3",fw,str(o2+w2)+"+V"]) - wp.extend(["LowerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2+w2/2)+"+V"]) - wp.extend(["UpperFrame","Frame","Wire4,Wire5",fw,str(o2)+"+V"]) - wp.extend(["UpperGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2/2)+"+V"]) - - elif windowtype == "Sliding 2-pane": - - wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector((width/2)-tol,h1+tol,0) - p3 = Vector((width/2)-tol,height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector((width/2)-h2,h1+h2,0) - p7 = Vector((width/2)-h2,height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector((width/2)+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector((width/2)+tol,height-(h1+tol),0) - p5 = Vector((width/2)+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector((width/2)+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('Equal',22,14)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol)) - s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22)) - s.addConstraint(Sketcher.Constraint('PointOnObject',12,2,20)) - if h1 == h2: - s.renameConstraint(55,'Frame5') - s.renameConstraint(56,'Frame6') - s.renameConstraint(57,'Frame7') - s.renameConstraint(58,'Frame8') - s.renameConstraint(59,'Frame9') - s.renameConstraint(60,'Frame10') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["LeftFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) - wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) - wp.extend(["RightFrame","Frame","Wire4,Wire5",fw,str(o2+w2)+"+V"]) - wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2+w2/2)+"+V"]) - - elif windowtype == "Sliding 4-pane": - - wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector(width/4-tol,h1+tol,0) - p3 = Vector(width/4-tol,height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector(width/4-h2,h1+h2,0) - p7 = Vector(width/4-h2,height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector(width/4+tol,h1+tol,0) - p2 = Vector(width/2-tol,h1+tol,0) - p3 = Vector(width/2-tol,height-(h1+tol),0) - p4 = Vector(width/4+tol,height-(h1+tol),0) - p5 = Vector(width/4+h2,h1+h2,0) - p6 = Vector(width/2-h2,h1+h2,0) - p7 = Vector(width/2-h2,height-(h1+h2),0) - p8 = Vector(width/4+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector(width/2+tol,h1+tol,0) - p2 = Vector(width*3/4-tol,h1+tol,0) - p3 = Vector(width*3/4-tol,height-(h1+tol),0) - p4 = Vector(width/2+tol,height-(h1+tol),0) - p5 = Vector(width/2+h2,h1+h2,0) - p6 = Vector(width*3/4-h2,h1+h2,0) - p7 = Vector(width*3/4-h2,height-(h1+h2),0) - p8 = Vector(width/2+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - p1 = Vector(width*3/4+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector(width*3/4+tol,height-(h1+tol),0) - p5 = Vector(width*3/4+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector(width*3/4+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',8,2,16,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',17,1,27,2,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',24,2,32,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',32,2,4,2,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,2,6,2,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',17,2,26,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',25,2,34,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',9,2,18,2,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',16,2,24,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceY',24,2,32,1,0.0)) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',13,2,9,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',13,2,9,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',16,1,20,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',24,1,28,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',24,1,28,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',29,2,25,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',29,2,25,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',32,1,36,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',32,1,36,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',37,2,33,2,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',37,2,33,2,h2)) - s.addConstraint(Sketcher.Constraint('Equal',14,22)) - s.addConstraint(Sketcher.Constraint('Equal',22,30)) - s.addConstraint(Sketcher.Constraint('Equal',30,38)) - if h1 == h2: - s.renameConstraint(100,'Frame5') - s.renameConstraint(101,'Frame6') - s.renameConstraint(102,'Frame7') - s.renameConstraint(103,'Frame8') - s.renameConstraint(104,'Frame9') - s.renameConstraint(105,'Frame10') - s.renameConstraint(106,'Frame11') - s.renameConstraint(107,'Frame12') - s.renameConstraint(108,'Frame13') - s.renameConstraint(109,'Frame14') - s.renameConstraint(110,'Frame15') - s.renameConstraint(111,'Frame16') - s.renameConstraint(112,'Frame17') - s.renameConstraint(113,'Frame18') - s.renameConstraint(114,'Frame19') - s.renameConstraint(115,'Frame20') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["LeftMostFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) - wp.extend(["LeftMostGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) - wp.extend(["LeftFrame","Frame","Wire4,Wire5",fw,str(o2+w2)+"+V"]) - wp.extend(["LeftGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2+w2/2)+"+V"]) - wp.extend(["RightFrame","Frame","Wire6,Wire7",fw,str(o2+w2)+"+V"]) - wp.extend(["RightGlass","Glass panel","Wire7",str(w2/gla),str(o2+w2+w2/2)+"+V"]) - wp.extend(["RightMostFrame","Frame","Wire8,Wire9",fw,str(o2)+"+V"]) - wp.extend(["RightMostGlass","Glass panel","Wire9",str(w2/gla),str(o2+w2/2)+"+V"]) - - elif windowtype == "Simple door": - - wp = doorFrame(s,width,height,h1,w1,o1) - wp.extend(["Door","Solid panel","Wire1",str(w2),str(o2)+"+V"]) - - elif windowtype == "Glass door": - - wp = doorFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h3,0) - p6 = Vector(width-(h1+h2),h1+h3,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h3)) - s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) - if h2 == h1: - s.renameConstraint(39,'Frame5') - s.renameConstraint(40,'Frame6') - s.renameConstraint(42,'Frame7') - s.renameConstraint(41,'Frame8') - fw = str(w2) - if w2 == w1: - fw = "0.00+V" - wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) - wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) - - return (s,wp) - - if windowtype in WindowPresets: - default = makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2) - FreeCAD.ActiveDocument.recompute() - if default: - if placement: - default[0].Placement = placement - FreeCAD.ActiveDocument.recompute() - obj = makeWindow(default[0],width,height,default[1]) - obj.Preset = WindowPresets.index(windowtype)+1 - obj.Frame = h1 - obj.Offset = o1 - obj.Placement = FreeCAD.Placement() # unable to find where this bug comes from... - if "door" in windowtype: - obj.IfcType = "Door" - obj.Label = translate("Arch","Door") - FreeCAD.ActiveDocument.recompute() - return obj - - print("Arch: Unknown window type") @@ -585,7 +142,7 @@ class _CommandWindow: "the Arch Window command definition" def __init__(self): - + self.doormode = False def GetResources(self): @@ -653,6 +210,17 @@ class _CommandWindow: FreeCAD.ActiveDocument.recompute() return + # Try to detect an object to use as a window type - TODO we must make this safer + + elif obj.Shape.Solids and (Draft.getType(obj) not in ["Wall","Structure","Roof"]): + # we consider the selected object as a type + FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Window")) + FreeCADGui.addModule("Arch") + FreeCADGui.doCommand("Arch.makeWindow(FreeCAD.ActiveDocument."+obj.Name+")") + FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() + return + # interactive mode if hasattr(FreeCAD,"DraftWorkingPlane"): FreeCAD.DraftWorkingPlane.setup() @@ -1029,22 +597,11 @@ class _Window(ArchComponent.Component): # mark host to recompute so it can detect this object host.touch() if prop in ["Width","Height","Frame"]: - if obj.Base and hasattr(obj.Base,"Constraints"): - if prop == "Height": - if obj.Height.Value > 0: - for c in obj.Base.Constraints: - if c.Name == "Height": - obj.Base.setDatum(c.Name,obj.Height.Value) - elif prop == "Width": - if obj.Width.Value > 0: - for c in obj.Base.Constraints: - if c.Name == "Width": - obj.Base.setDatum(c.Name,obj.Width.Value) - elif prop == "Frame": - if obj.Frame.Value > 0: - for c in obj.Base.Constraints: - if "Frame" in c.Name: - obj.Base.setDatum(c.Name,obj.Frame.Value) + if obj.Base: + if hasattr(obj.Base,"Constraints") and (prop in [c.Name for c in obj.Base.Constraints]): + val = getattr(obj,prop).Value + if val > 0: + obj.Base.setDatum(prop,val) else: ArchComponent.Component.onChanged(self,obj,prop) @@ -1272,8 +829,9 @@ class _Window(ArchComponent.Component): elif not obj.WindowParts: if not obj.Base.Shape.isNull(): base = obj.Base.Shape.copy() - if not DraftGeomUtils.isNull(pl): - base.Placement = base.Placement.multiply(pl) + # obj placement is already added by applyShape() below + #if not DraftGeomUtils.isNull(pl): + # base.Placement = base.Placement.multiply(pl) else: print("Arch: Bad formatting of window parts definitions") @@ -1311,8 +869,11 @@ class _Window(ArchComponent.Component): if hasattr(obj.Subvolume,'Shape'): if not obj.Subvolume.Shape.isNull(): sh = obj.Subvolume.Shape.copy() + pl = FreeCAD.Placement(sh.Placement) + pl = pl.multiply(obj.Placement) if plac: - sh.Placement = plac + pl = pl.multiply(plac) + sh.Placement = pl return sh # getting extrusion depth @@ -1366,7 +927,7 @@ class _Window(ArchComponent.Component): f = base.Shape.Wires[obj.HoleWire-1] if not f: - if Draft.isClone(obj,"Window"): + if Draft.isClone(obj,"Window"): # check original HoleWire then if orig.HoleWire > 0: if orig.HoleWire <= len(base.Shape.Wires): @@ -1487,8 +1048,6 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): if self.areDifferentColors(obj.ViewObject.DiffuseColor,obj.CloneOf.ViewObject.DiffuseColor) or force: obj.ViewObject.DiffuseColor = obj.CloneOf.ViewObject.DiffuseColor return - if not obj.WindowParts: - return if not obj.Shape: return if not obj.Shape.Solids: @@ -1499,25 +1058,23 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): base = obj.ViewObject.ShapeColor for i in range(len(solids)): ccol = None - if len(obj.WindowParts) > i*5: + if obj.WindowParts and len(obj.WindowParts) > i*5: + # WindowParts-based window name = obj.WindowParts[(i*5)] mtype = obj.WindowParts[(i*5)+1] - if hasattr(obj,"Material"): - if obj.Material: - if hasattr(obj.Material,"Materials"): - if obj.Material.Names: - mat = None - if name in obj.Material.Names: - mat = obj.Material.Materials[obj.Material.Names.index(name)] - elif mtype in obj.Material.Names: - mat = obj.Material.Materials[obj.Material.Names.index(mtype)] - if mat: - if 'DiffuseColor' in mat.Material: - if "(" in mat.Material['DiffuseColor']: - ccol = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")]) - if ccol and ('Transparency' in mat.Material): - t = float(mat.Material['Transparency'])/100.0 - ccol = (ccol[0],ccol[1],ccol[2],t) + ccol = self.getSolidMaterial(obj,name,mtype) + elif obj.Base and hasattr(obj.Base,"Shape"): + # Type-based window: obj.Base furnishes the window solids + sol1 = self.getSolidSignature(solids[i]) + # here we look for all the ways to retrieve a name for each + # solid. Currently we look for similar solids in the + if hasattr(obj.Base,"Group"): + for child in obj.Base.Group: + if hasattr(child,"Shape") and child.Shape and child.Shape.Solids: + sol2 = self.getSolidSignature(child.Shape) + if sol1 == sol2: + ccol = self.getSolidMaterial(obj,child.Label) + break if not ccol: typeidx = (i*5)+1 if typeidx < len(obj.WindowParts): @@ -1531,6 +1088,32 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): if self.areDifferentColors(colors,obj.ViewObject.DiffuseColor) or force: obj.ViewObject.DiffuseColor = colors + def getSolidSignature(self,solid): + + """Returns a tuple defining as uniquely as possible a solid""" + + return (solid.ShapeType,solid.Volume,solid.Area,solid.Length) + + def getSolidMaterial(self,obj,name,mtype=None): + + ccol = None + if hasattr(obj,"Material"): + if obj.Material: + if hasattr(obj.Material,"Materials"): + if obj.Material.Names: + mat = None + if name in obj.Material.Names: + mat = obj.Material.Materials[obj.Material.Names.index(name)] + elif mtype and (mtype in obj.Material.Names): + mat = obj.Material.Materials[obj.Material.Names.index(mtype)] + if mat: + if 'DiffuseColor' in mat.Material: + if "(" in mat.Material['DiffuseColor']: + ccol = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")]) + if ccol and ('Transparency' in mat.Material): + t = float(mat.Material['Transparency'])/100.0 + ccol = (ccol[0],ccol[1],ccol[2],t) + return ccol class _ArchWindowTaskPanel: diff --git a/src/Mod/Arch/ArchWindowPresets.py b/src/Mod/Arch/ArchWindowPresets.py new file mode 100644 index 0000000000..19c756c2ae --- /dev/null +++ b/src/Mod/Arch/ArchWindowPresets.py @@ -0,0 +1,487 @@ +#*************************************************************************** +#* Copyright (c) 2020 Yorik van Havre * +#* * +#* This program is free software; you can redistribute it and/or modify * +#* it under the terms of the GNU Lesser General Public License (LGPL) * +#* as published by the Free Software Foundation; either version 2 of * +#* the License, or (at your option) any later version. * +#* for detail see the LICENCE text file. * +#* * +#* This program 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 program; if not, write to the Free Software * +#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +#* USA * +#* * +#*************************************************************************** + +import FreeCAD +from FreeCAD import Vector + +WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane", + "Sliding 2-pane", "Simple door", "Glass door", "Sliding 4-pane"] + +def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None): + + """makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,[placement]): makes a + window object based on the given data. windowtype must be one of the names + defined in Arch.WindowPresets""" + + if not FreeCAD.ActiveDocument: + FreeCAD.Console.PrintError("No active document. Aborting\n") + return + + def makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2): + + import Part,Sketcher + width = float(width) + height = float(height) + h1 = float(h1) + h2 = float(h2) + h3 = float(h3) + w1 = float(w1) + w2 = float(w2) + o1 = float(o1) + o2 = float(o2) + # small spacing to avoid wrong auto-wires in sketch + tol = h1/10 + # glass size divider + gla = 10 + s = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch') + + def addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8): + + "adds two rectangles to the given sketch" + + idx = s.GeometryCount + s.addGeometry(Part.LineSegment(p1,p2)) + s.addGeometry(Part.LineSegment(p2,p3)) + s.addGeometry(Part.LineSegment(p3,p4)) + s.addGeometry(Part.LineSegment(p4,p1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx,2,idx+1,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+1,2,idx+2,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+2,2,idx+3,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+3,2,idx,1)) + s.addConstraint(Sketcher.Constraint('Horizontal',idx)) + s.addConstraint(Sketcher.Constraint('Horizontal',idx+2)) + s.addConstraint(Sketcher.Constraint('Vertical',idx+1)) + s.addConstraint(Sketcher.Constraint('Vertical',idx+3)) + s.addGeometry(Part.LineSegment(p5,p6)) + s.addGeometry(Part.LineSegment(p6,p7)) + s.addGeometry(Part.LineSegment(p7,p8)) + s.addGeometry(Part.LineSegment(p8,p5)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+4,2,idx+5,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+5,2,idx+6,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+6,2,idx+7,1)) + s.addConstraint(Sketcher.Constraint('Coincident',idx+7,2,idx+4,1)) + s.addConstraint(Sketcher.Constraint('Horizontal',idx+4)) + s.addConstraint(Sketcher.Constraint('Horizontal',idx+6)) + s.addConstraint(Sketcher.Constraint('Vertical',idx+5)) + s.addConstraint(Sketcher.Constraint('Vertical',idx+7)) + + def outerFrame(s,width,height,h1,w1,o1): + + p1 = Vector(0,0,0) + p2 = Vector(width,0,0) + p3 = Vector(width,height,0) + p4 = Vector(0,height,0) + p5 = Vector(h1,h1,0) + p6 = Vector(width-h1,h1,0) + p7 = Vector(width-h1,height-h1,0) + p8 = Vector(h1,height-h1,0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16 + s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17 + s.renameConstraint(16, 'Height') + s.renameConstraint(17, 'Width') + s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,h1)) + s.renameConstraint(18, 'Frame1') + s.renameConstraint(19, 'Frame2') + s.renameConstraint(20, 'Frame3') + s.renameConstraint(21, 'Frame4') + s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1)) + return ["OuterFrame","Frame","Wire0,Wire1",str(w1-w2)+"+V","0.00+V"] + + def doorFrame(s,width,height,h1,w1,o1): + + p1 = Vector(0,0,0) + p2 = Vector(width,0,0) + p3 = Vector(width,height,0) + p4 = Vector(0,height,0) + p5 = Vector(h1,0,0) + p6 = Vector(width-h1,0,0) + p7 = Vector(width-h1,height-h1,0) + p8 = Vector(h1,height-h1,0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16 + s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17 + s.renameConstraint(16, 'Height') + s.renameConstraint(17, 'Width') + s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1)) + s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,0.0)) + s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1)) + s.renameConstraint(18, 'Frame1') + s.renameConstraint(19, 'Frame2') + s.renameConstraint(20, 'Frame3') + return ["OuterFrame","Frame","Wire0,Wire1",str(w1-w2)+"+V","0.00+V"] + + if windowtype == "Fixed": + + wp = outerFrame(s,width,height,h1,w1,o1) + wp.extend(["Glass","Glass panel","Wire1",str(w1/gla),str(w1/2)+"+V"]) + + elif windowtype == "Open 1-pane": + + wp = outerFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) + if h2 == h1: + s.renameConstraint(39,'Frame5') + s.renameConstraint(40,'Frame6') + s.renameConstraint(42,'Frame7') + s.renameConstraint(41,'Frame8') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) + wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + + elif windowtype == "Open 2-pane": + + wp = outerFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector((width/2)-tol,h1+tol,0) + p3 = Vector((width/2)-tol,height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector((width/2)-h2,h1+h2,0) + p7 = Vector((width/2)-h2,height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector((width/2)+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector((width/2)+tol,height-(h1+tol),0) + p5 = Vector((width/2)+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector((width/2)+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('Equal',22,14)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol)) + s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22)) + s.addConstraint(Sketcher.Constraint('PointOnObject',20,1,12)) + if h1 == h2: + s.renameConstraint(55,'Frame5') + s.renameConstraint(56,'Frame6') + s.renameConstraint(57,'Frame7') + s.renameConstraint(58,'Frame8') + s.renameConstraint(59,'Frame9') + s.renameConstraint(60,'Frame10') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["LeftFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) + wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + wp.extend(["RightFrame","Frame","Wire4,Wire5",fw,str(o2)+"+V"]) + wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2/2)+"+V"]) + + elif windowtype == "Sash 2-pane": + + wp = outerFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),(height/2)-tol,0) + p4 = Vector(h1+tol,(height/2)-tol,0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),(height/2)-h2,0) + p8 = Vector(h1+h2,(height/2)-h2,0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector(h1+tol,(height/2)+tol,0) + p2 = Vector(width-(h1+tol),(height/2)+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,(height/2)+h2,0) + p6 = Vector(width-(h1+h2),(height/2)+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',16,2,20,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,2,14,2,-h2)) + s.addConstraint(Sketcher.Constraint('Equal',23,15)) + s.addConstraint(Sketcher.Constraint('DistanceX',12,1,20,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceX',13,2,20,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,16,1,tol)) + s.addConstraint(Sketcher.Constraint('PointOnObject',9,2,17)) + s.addConstraint(Sketcher.Constraint('PointOnObject',16,1,11)) + if h1 == h2: + s.renameConstraint(55,'Frame5') + s.renameConstraint(56,'Frame6') + s.renameConstraint(57,'Frame7') + s.renameConstraint(58,'Frame8') + s.renameConstraint(59,'Frame9') + s.renameConstraint(60,'F10') + s.setExpression('.Constraints.F10','-.Constraints.Frame5') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["LowerFrame","Frame","Wire2,Wire3",fw,str(o2+w2)+"+V"]) + wp.extend(["LowerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2+w2/2)+"+V"]) + wp.extend(["UpperFrame","Frame","Wire4,Wire5",fw,str(o2)+"+V"]) + wp.extend(["UpperGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2/2)+"+V"]) + + elif windowtype == "Sliding 2-pane": + + wp = outerFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector((width/2)-tol,h1+tol,0) + p3 = Vector((width/2)-tol,height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector((width/2)-h2,h1+h2,0) + p7 = Vector((width/2)-h2,height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector((width/2)+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector((width/2)+tol,height-(h1+tol),0) + p5 = Vector((width/2)+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector((width/2)+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('Equal',22,14)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol)) + s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22)) + s.addConstraint(Sketcher.Constraint('PointOnObject',12,2,20)) + if h1 == h2: + s.renameConstraint(55,'Frame5') + s.renameConstraint(56,'Frame6') + s.renameConstraint(57,'Frame7') + s.renameConstraint(58,'Frame8') + s.renameConstraint(59,'Frame9') + s.renameConstraint(60,'Frame10') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["LeftFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) + wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + wp.extend(["RightFrame","Frame","Wire4,Wire5",fw,str(o2+w2)+"+V"]) + wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2+w2/2)+"+V"]) + + elif windowtype == "Sliding 4-pane": + + wp = outerFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector(width/4-tol,h1+tol,0) + p3 = Vector(width/4-tol,height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector(width/4-h2,h1+h2,0) + p7 = Vector(width/4-h2,height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector(width/4+tol,h1+tol,0) + p2 = Vector(width/2-tol,h1+tol,0) + p3 = Vector(width/2-tol,height-(h1+tol),0) + p4 = Vector(width/4+tol,height-(h1+tol),0) + p5 = Vector(width/4+h2,h1+h2,0) + p6 = Vector(width/2-h2,h1+h2,0) + p7 = Vector(width/2-h2,height-(h1+h2),0) + p8 = Vector(width/4+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector(width/2+tol,h1+tol,0) + p2 = Vector(width*3/4-tol,h1+tol,0) + p3 = Vector(width*3/4-tol,height-(h1+tol),0) + p4 = Vector(width/2+tol,height-(h1+tol),0) + p5 = Vector(width/2+h2,h1+h2,0) + p6 = Vector(width*3/4-h2,h1+h2,0) + p7 = Vector(width*3/4-h2,height-(h1+h2),0) + p8 = Vector(width/2+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + p1 = Vector(width*3/4+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector(width*3/4+tol,height-(h1+tol),0) + p5 = Vector(width*3/4+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector(width*3/4+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',8,2,16,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',17,1,27,2,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',24,2,32,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',32,2,4,2,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,2,6,2,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',17,2,26,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',25,2,34,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',9,2,18,2,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',16,2,24,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceY',24,2,32,1,0.0)) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',13,2,9,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',13,2,9,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',16,1,20,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',24,1,28,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',24,1,28,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',29,2,25,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',29,2,25,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',32,1,36,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',32,1,36,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',37,2,33,2,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',37,2,33,2,h2)) + s.addConstraint(Sketcher.Constraint('Equal',14,22)) + s.addConstraint(Sketcher.Constraint('Equal',22,30)) + s.addConstraint(Sketcher.Constraint('Equal',30,38)) + if h1 == h2: + s.renameConstraint(100,'Frame5') + s.renameConstraint(101,'Frame6') + s.renameConstraint(102,'Frame7') + s.renameConstraint(103,'Frame8') + s.renameConstraint(104,'Frame9') + s.renameConstraint(105,'Frame10') + s.renameConstraint(106,'Frame11') + s.renameConstraint(107,'Frame12') + s.renameConstraint(108,'Frame13') + s.renameConstraint(109,'Frame14') + s.renameConstraint(110,'Frame15') + s.renameConstraint(111,'Frame16') + s.renameConstraint(112,'Frame17') + s.renameConstraint(113,'Frame18') + s.renameConstraint(114,'Frame19') + s.renameConstraint(115,'Frame20') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["LeftMostFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) + wp.extend(["LeftMostGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + wp.extend(["LeftFrame","Frame","Wire4,Wire5",fw,str(o2+w2)+"+V"]) + wp.extend(["LeftGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2+w2/2)+"+V"]) + wp.extend(["RightFrame","Frame","Wire6,Wire7",fw,str(o2+w2)+"+V"]) + wp.extend(["RightGlass","Glass panel","Wire7",str(w2/gla),str(o2+w2+w2/2)+"+V"]) + wp.extend(["RightMostFrame","Frame","Wire8,Wire9",fw,str(o2)+"+V"]) + wp.extend(["RightMostGlass","Glass panel","Wire9",str(w2/gla),str(o2+w2/2)+"+V"]) + + elif windowtype == "Simple door": + + wp = doorFrame(s,width,height,h1,w1,o1) + wp.extend(["Door","Solid panel","Wire1",str(w2),str(o2)+"+V"]) + + elif windowtype == "Glass door": + + wp = doorFrame(s,width,height,h1,w1,o1) + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h3,0) + p6 = Vector(width-(h1+h2),h1+h3,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h3)) + s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) + if h2 == h1: + s.renameConstraint(39,'Frame5') + s.renameConstraint(40,'Frame6') + s.renameConstraint(42,'Frame7') + s.renameConstraint(41,'Frame8') + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"]) + wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + + return (s,wp) + + if windowtype in WindowPresets: + import ArchWindow + default = makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2) + FreeCAD.ActiveDocument.recompute() + if default: + if placement: + default[0].Placement = placement + FreeCAD.ActiveDocument.recompute() + obj = ArchWindow.makeWindow(default[0],width,height,default[1]) + obj.Preset = WindowPresets.index(windowtype)+1 + obj.Frame = h1 + obj.Offset = o1 + obj.Placement = FreeCAD.Placement() # unable to find where this bug comes from... + if "door" in windowtype: + obj.IfcType = "Door" + obj.Label = translate("Arch","Door") + FreeCAD.ActiveDocument.recompute() + return obj + + print("Arch: Unknown window type") diff --git a/src/Mod/Arch/CMakeLists.txt b/src/Mod/Arch/CMakeLists.txt index 1ed820e16e..1e9a2041cd 100644 --- a/src/Mod/Arch/CMakeLists.txt +++ b/src/Mod/Arch/CMakeLists.txt @@ -25,6 +25,7 @@ SET(Arch_SRCS importDAE.py importOBJ.py ArchWindow.py + ArchWindowPresets.py ArchAxis.py ArchVRM.py ArchRoof.py From ac7da8b39f5287258ae1585620bc53d9466f35c8 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 14:49:18 +0200 Subject: [PATCH 13/46] clang/gcc/cmake: [skip ci] suppress deprecated-copy warnings for OpenInventor class SbMatrix --- src/Mod/Mesh/Gui/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Mesh/Gui/CMakeLists.txt b/src/Mod/Mesh/Gui/CMakeLists.txt index c0850c563a..aa25884867 100644 --- a/src/Mod/Mesh/Gui/CMakeLists.txt +++ b/src/Mod/Mesh/Gui/CMakeLists.txt @@ -174,6 +174,7 @@ SET(MeshGuiIcon_SVG if (EIGEN3_NO_DEPRECATED_COPY) set_source_files_properties( SoFCIndexedFaceSet.cpp + ViewProvider.cpp PROPERTIES COMPILE_FLAGS ${EIGEN3_NO_DEPRECATED_COPY}) endif () From 7b72dcb062d23eed3ebf4e52cba3abd1fd67d03e Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 12:24:55 +0200 Subject: [PATCH 14/46] Qt5: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] --- src/Gui/Command.cpp | 2 +- src/Gui/DlgActionsImp.cpp | 8 ++++---- src/Gui/DlgMacroExecuteImp.cpp | 2 +- src/Gui/DlgParameterImp.cpp | 18 +++++++++--------- src/Gui/DlgSettingsImageImp.cpp | 4 ++-- src/Gui/EditorView.cpp | 2 +- src/Gui/FileDialog.cpp | 6 +++--- src/Gui/NetworkRetriever.cpp | 4 ++-- src/Gui/NetworkRetriever.h | 2 +- src/Gui/PythonConsole.cpp | 6 +++--- src/Mod/Drawing/Gui/Command.cpp | 4 ++-- src/Mod/Image/Gui/Command.cpp | 4 ++-- src/Mod/Part/Gui/DlgPartImportIgesImp.cpp | 2 +- src/Mod/Part/Gui/DlgPartImportStepImp.cpp | 2 +- src/Mod/Points/Gui/Command.cpp | 4 ++-- src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp | 2 +- src/Mod/Spreadsheet/Gui/qtcolorpicker.h | 2 +- src/Mod/TechDraw/Gui/Command.cpp | 2 +- src/Mod/TechDraw/Gui/CommandDecorate.cpp | 2 +- src/Mod/Test/Gui/UnitTestImp.h | 2 +- 20 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index cbe4f5d98f..c6c139757d 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -119,7 +119,7 @@ using namespace Gui::DockWnd; * void activated(int) * { * QString filter ... // make a filter of all supported file formats - * QStringList FileList = QFileDialog::getOpenFileNames( filter,QString::null, getMainWindow() ); + * QStringList FileList = QFileDialog::getOpenFileNames( filter,QString(), getMainWindow() ); * for ( QStringList::Iterator it = FileList.begin(); it != FileList.end(); ++it ) { * getGuiApplication()->open((*it).latin1()); * } diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index 0a6c64c724..40a733c462 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -216,7 +216,7 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite ui->actionStatus -> setText(QString::fromUtf8(pScript->getStatusTip())); ui->actionAccel -> setText(QString::fromLatin1(pScript->getAccel())); ui->pixmapLabel->clear(); - m_sPixmap = QString::null; + m_sPixmap.clear(); const char* name = pScript->getPixmap(); if (name && std::strlen(name) > 2) { @@ -278,7 +278,7 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked() if (!m_sPixmap.isEmpty()) macro->setPixmap(m_sPixmap.toLatin1()); ui->pixmapLabel->clear(); - m_sPixmap = QString::null; + m_sPixmap.clear(); if (!ui->actionAccel->text().isEmpty()) { macro->setAccel(ui->actionAccel->text().toLatin1()); @@ -335,7 +335,7 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked() if (!m_sPixmap.isEmpty()) macro->setPixmap(m_sPixmap.toLatin1()); ui->pixmapLabel->clear(); - m_sPixmap = QString::null; + m_sPixmap.clear(); if (!ui->actionAccel->text().isEmpty()) { macro->setAccel(ui->actionAccel->text().toLatin1()); @@ -501,7 +501,7 @@ void DlgCustomActionsImp::on_buttonChoosePixmap_clicked() dlg.exec(); ui->pixmapLabel->clear(); - m_sPixmap = QString::null; + m_sPixmap.clear(); if (dlg.result() == QDialog::Accepted) { QListWidgetItem* item = dlg.currentItem(); if (item) { diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index 95f06680f2..95870d03b6 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -350,7 +350,7 @@ void DlgMacroExecuteImp::on_createButton_clicked() { // query file name QString fn = QInputDialog::getText(this, tr("Macro file"), tr("Enter a file name, please:"), - QLineEdit::Normal, QString::null, 0); + QLineEdit::Normal, QString(), 0); if (!fn.isEmpty()) { QString suffix = QFileInfo(fn).suffix().toLower(); diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 63b5df542f..0d87d383f4 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -550,7 +550,7 @@ void ParameterGroup::onCreateSubgroup() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New sub-group"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok ); + QLineEdit::Normal, QString(), &ok ); if (ok && Gui::validateInput(this, name)) { @@ -577,7 +577,7 @@ void ParameterGroup::onCreateSubgroup() void ParameterGroup::onExportToFile() { QString file = FileDialog::getSaveFileName( this, tr("Export parameter to file"), - QString::null, QString::fromLatin1("XML (*.FCParam)")); + QString(), QString::fromLatin1("XML (*.FCParam)")); if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); @@ -593,7 +593,7 @@ void ParameterGroup::onExportToFile() void ParameterGroup::onImportFromFile() { QString file = FileDialog::getOpenFileName( this, tr("Import parameter from file"), - QString::null, QString::fromLatin1("XML (*.FCParam)")); + QString(), QString::fromLatin1("XML (*.FCParam)")); if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); @@ -771,7 +771,7 @@ void ParameterValue::onCreateTextItem() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New text item"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (!ok || !Gui::validateInput(this, name)) return; @@ -787,7 +787,7 @@ void ParameterValue::onCreateTextItem() } QString val = QInputDialog::getText(this, QObject::tr("New text item"), QObject::tr("Enter your text:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if ( ok && !val.isEmpty() ) { ParameterValueItem *pcItem; @@ -800,7 +800,7 @@ void ParameterValue::onCreateIntItem() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New integer item"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (!ok || !Gui::validateInput(this, name)) return; @@ -830,7 +830,7 @@ void ParameterValue::onCreateUIntItem() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New unsigned item"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (!ok || !Gui::validateInput(this, name)) return; @@ -866,7 +866,7 @@ void ParameterValue::onCreateFloatItem() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New float item"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (!ok || !Gui::validateInput(this, name)) return; @@ -895,7 +895,7 @@ void ParameterValue::onCreateBoolItem() { bool ok; QString name = QInputDialog::getText(this, QObject::tr("New Boolean item"), QObject::tr("Enter the name:"), - QLineEdit::Normal, QString::null, &ok); + QLineEdit::Normal, QString(), &ok); if (!ok || !Gui::validateInput(this, name)) return; diff --git a/src/Gui/DlgSettingsImageImp.cpp b/src/Gui/DlgSettingsImageImp.cpp index cc17e19e82..e8a326a604 100644 --- a/src/Gui/DlgSettingsImageImp.cpp +++ b/src/Gui/DlgSettingsImageImp.cpp @@ -134,12 +134,12 @@ int DlgSettingsImageImp::imageHeight() const /** * Returns the comment of the picture. If for the currently selected image format no comments are supported - * QString::null is returned. + * QString() is returned. */ QString DlgSettingsImageImp::comment() const { if ( !ui->textEditComment->isEnabled() ) - return QString::null; + return QString(); else return ui->textEditComment->toPlainText(); } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 59676de47b..27e9127263 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -328,7 +328,7 @@ void EditorView::setDisplayName(EditorView::DisplayName type) bool EditorView::saveAs(void) { QString fn = FileDialog::getSaveFileName(this, QObject::tr("Save Macro"), - QString::null, QString::fromLatin1("%1 (*.FCMacro);;Python (*.py)").arg(tr("FreeCAD macro"))); + QString(), QString::fromLatin1("%1 (*.FCMacro);;Python (*.py)").arg(tr("FreeCAD macro"))); if (fn.isEmpty()) return false; setCurrentFileName(fn); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 79c957c097..7a982f4587 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -221,7 +221,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, setWorkingDirectory(file); return file; } else { - return QString::null; + return QString(); } } @@ -316,7 +316,7 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c setWorkingDirectory(file); return file; } else { - return QString::null; + return QString(); } } @@ -622,7 +622,7 @@ FileChooser::FileChooser ( QWidget * parent ) : QWidget(parent) , md( File ) , accMode( AcceptOpen ) - , _filter( QString::null ) + , _filter( QString() ) { QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index 581b4fd9d9..646a8baf7d 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -460,8 +460,8 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg) bool bAuthor = hGrp->GetBool ("Authorize", false); if (bUseProxy) { - QString username = QString::null; - QString password = QString::null; + QString username; + QString password; if (bAuthor) { QDialog dlg(getMainWindow()); diff --git a/src/Gui/NetworkRetriever.h b/src/Gui/NetworkRetriever.h index 03cae67e1a..1a90dde4b3 100644 --- a/src/Gui/NetworkRetriever.h +++ b/src/Gui/NetworkRetriever.h @@ -48,7 +48,7 @@ public: void setNumberOfTries( int ); void setOutputFile( const QString& ); void setEnableTimestamp(bool); - void setProxy( const QString&, const QString& = QString::null, const QString& = QString::null ); + void setProxy( const QString&, const QString& = QString(), const QString& = QString() ); void setEnableRecursive( bool, int = 0 ); void setFollowRelative( bool ); void setEnableConvert( bool ); diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 360a3eaf2f..21fc9ce5c4 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -720,13 +720,13 @@ void PythonConsole::printPrompt(PythonConsole::Prompt mode) // write normal messages if (!d->output.isEmpty()) { appendOutput(d->output, (int)PythonConsoleP::Message); - d->output = QString::null; + d->output.clear(); } // write error messages if (!d->error.isEmpty()) { appendOutput(d->error, (int)PythonConsoleP::Error); - d->error = QString::null; + d->error.clear(); } // Append the prompt string @@ -1326,7 +1326,7 @@ void PythonConsole::onSaveHistoryAs() void PythonConsole::onInsertFileName() { - QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), tr("Insert file name"), QString::null, + QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), tr("Insert file name"), QString(), QString::fromLatin1("%1 (*.*)").arg(tr("All Files"))); if ( fn.isEmpty() ) return; diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index ab4351cfa3..5114064418 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -69,7 +69,7 @@ void CmdDrawingOpen::activated(int iMsg) { Q_UNUSED(iMsg); // Reading an image - QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString::null, + QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString(), QString::fromLatin1("%1 (*.svg *.svgz)").arg(QObject::tr("Scalable Vector Graphic"))); if (!filename.isEmpty()) { @@ -592,7 +592,7 @@ void CmdDrawingSymbol::activated(int iMsg) } } // Reading an image - QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString::null, + QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an SVG file to open"), QString(), QString::fromLatin1("%1 (*.svg *.svgz)").arg(QObject::tr("Scalable Vector Graphic"))); if (!filename.isEmpty()) { diff --git a/src/Mod/Image/Gui/Command.cpp b/src/Mod/Image/Gui/Command.cpp index ab09cee293..4aae6b9ff0 100644 --- a/src/Mod/Image/Gui/Command.cpp +++ b/src/Mod/Image/Gui/Command.cpp @@ -74,7 +74,7 @@ void CmdImageOpen::activated(int iMsg) str << ");;" << QObject::tr("All files") << " (*.*)"; // Reading an image QString s = QFileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an image file to open"), - QString::null, formats); + QString(), formats); if (!s.isEmpty()) { try { s = Base::Tools::escapeEncodeFilename(s); @@ -122,7 +122,7 @@ void CmdCreateImagePlane::activated(int iMsg) str << ");;" << QObject::tr("All files") << " (*.*)"; // Reading an image QString s = QFileDialog::getOpenFileName(Gui::getMainWindow(), QObject::tr("Choose an image file to open"), - QString::null, formats); + QString(), formats); if (!s.isEmpty()) { QImage impQ(s); diff --git a/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp b/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp index 45a4893bcd..8633ba2084 100644 --- a/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp +++ b/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp @@ -68,7 +68,7 @@ void DlgPartImportIgesImp::OnApply() void DlgPartImportIgesImp::onChooseFileName() { - QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString::null, QString::null, + QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), QString::fromLatin1("%1 (*.igs *.iges);;%2 (*.*)")) .arg(tr("IGES"), tr("All Files")); diff --git a/src/Mod/Part/Gui/DlgPartImportStepImp.cpp b/src/Mod/Part/Gui/DlgPartImportStepImp.cpp index 5cda7cf700..c03e6eaab5 100644 --- a/src/Mod/Part/Gui/DlgPartImportStepImp.cpp +++ b/src/Mod/Part/Gui/DlgPartImportStepImp.cpp @@ -67,7 +67,7 @@ void DlgPartImportStepImp::OnApply() void DlgPartImportStepImp::onChooseFileName() { - QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString::null, QString::null, + QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), QString::fromLatin1("%1 (*.stp *.step);;%2 (*.*)")) .arg(tr("STEP"), tr("All Files")); diff --git a/src/Mod/Points/Gui/Command.cpp b/src/Mod/Points/Gui/Command.cpp index d18451730c..a0234b2d3b 100644 --- a/src/Mod/Points/Gui/Command.cpp +++ b/src/Mod/Points/Gui/Command.cpp @@ -77,7 +77,7 @@ void CmdPointsImport::activated(int iMsg) Q_UNUSED(iMsg); QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), - QString::null, QString(), QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)") + QString(), QString(), QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)") .arg(QObject::tr("Point formats"), QObject::tr("All Files"))); if (fn.isEmpty()) return; @@ -125,7 +125,7 @@ void CmdPointsExport::activated(int iMsg) std::vector points = getSelection().getObjectsOfType(Points::Feature::getClassTypeId()); for (std::vector::const_iterator it = points.begin(); it != points.end(); ++it) { QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), - QString::null, QString(), QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)") + QString(), QString(), QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)") .arg(QObject::tr("Point formats"), QObject::tr("All Files"))); if (fn.isEmpty()) break; diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp index fb6131fc1b..584f0ce2a8 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp @@ -168,7 +168,7 @@ class ColorPickerItem : public QFrame Q_OBJECT public: - ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString::null, + ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(), QWidget *parent = 0); ~ColorPickerItem(); diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.h b/src/Mod/Spreadsheet/Gui/qtcolorpicker.h index c874297cda..892ec140b5 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.h +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.h @@ -84,7 +84,7 @@ public: ~QtColorPicker(); - void insertColor(const QColor &color, const QString &text = QString::null, int index = -1); + void insertColor(const QColor &color, const QString &text = QString(), int index = -1); QColor currentColor() const; diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 7cd7822b85..bd98548f2c 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -1020,7 +1020,7 @@ void CmdTechDrawSymbol::activated(int iMsg) // Reading an image QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), - QObject::tr("Choose an SVG file to open"), QString::null, + QObject::tr("Choose an SVG file to open"), QString(), QString::fromLatin1("%1 (*.svg *.svgz);;%2 (*.*)"). arg(QObject::tr("Scalable Vector Graphic")). arg(QObject::tr("All Files"))); diff --git a/src/Mod/TechDraw/Gui/CommandDecorate.cpp b/src/Mod/TechDraw/Gui/CommandDecorate.cpp index 82e2b7036e..8e947a7077 100644 --- a/src/Mod/TechDraw/Gui/CommandDecorate.cpp +++ b/src/Mod/TechDraw/Gui/CommandDecorate.cpp @@ -412,7 +412,7 @@ void CmdTechDrawImage::activated(int iMsg) // Reading an image QString fileName = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString::fromUtf8(QT_TR_NOOP("Select an Image File")), - QString::null, + QString(), QString::fromUtf8(QT_TR_NOOP("Image (*.png *.jpg *.jpeg)"))); if (!fileName.isEmpty()) diff --git a/src/Mod/Test/Gui/UnitTestImp.h b/src/Mod/Test/Gui/UnitTestImp.h index 731f5d1015..22ff52d2a1 100644 --- a/src/Mod/Test/Gui/UnitTestImp.h +++ b/src/Mod/Test/Gui/UnitTestImp.h @@ -45,7 +45,7 @@ public: void clearUnitTests(); QString getUnitTest() const; void setStatusText(const QString& text); - void setProgressFraction(float fraction, const QString& = QString::null); + void setProgressFraction(float fraction, const QString& = QString()); void clearErrorList(); void insertError(const QString& failure, const QString& details); void setRunCount(int); From a9ae47a8beb998e348b6d7c3005bdee33eb8432d Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 12:30:11 +0200 Subject: [PATCH 15/46] Qt5: 'void QTreeWidget::setItemExpanded(const QTreeWidgetItem*, bool)' is deprecated: Use QTreeWidgetItem::setExpanded() instead [-Wdeprecated-declarations] --- src/Gui/DlgParameterImp.cpp | 8 ++++---- src/Gui/DlgToolbarsImp.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 0d87d383f4..4374362fa3 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -408,7 +408,7 @@ void DlgParameterImp::onChangeParameterSet(int index) } while (parent && !paths.empty()) { - paramGroup->setItemExpanded(parent, true); + parent->setExpanded(true); QTreeWidgetItem* item = parent; parent = 0; for (int index=0; index < item->childCount(); index++) { @@ -540,9 +540,9 @@ void ParameterGroup::onToggleSelectedItem() if (isItemSelected(sel)) { if ( isItemExpanded(sel) ) - setItemExpanded(sel, false); + sel->setExpanded(false); else if ( sel->childCount() > 0 ) - setItemExpanded(sel, true); + sel->setExpanded(true); } } @@ -618,7 +618,7 @@ void ParameterGroup::onImportFromFile() new ParameterGroupItem(para,*it); } - setItemExpanded(para, para->childCount()); + para->setExpanded(para->childCount()); } catch( const Base::Exception& ) { diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 9aee12cdaf..8715f23069 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -503,7 +503,7 @@ void DlgCustomToolbars::on_newButton_clicked() QTreeWidgetItem* item = new QTreeWidgetItem(ui->toolbarTreeWidget); item->setText(0, text); item->setCheckState(0, Qt::Checked); - ui->toolbarTreeWidget->setItemExpanded(item, true); + item->setExpanded(true); QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); From 59f38319a3d39057934de8b06b0891cd782a44fc Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 12:34:19 +0200 Subject: [PATCH 16/46] Qt5: 'bool QTreeWidget::isItemExpanded(const QTreeWidgetItem*) const' is deprecated: Use QTreeWidgetItem::isExpanded() instead [-Wdeprecated-declarations] --- src/Gui/DlgParameterImp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 4374362fa3..bea595d4cb 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -489,7 +489,7 @@ void ParameterGroup::contextMenuEvent ( QContextMenuEvent* event ) // do not allow to import parameters from a non-empty parameter group importAct->setEnabled(item->childCount() == 0); - if ( isItemExpanded(item) ) + if (item->isExpanded()) expandAct->setText( tr("Collapse") ); else expandAct->setText( tr("Expand") ); @@ -539,9 +539,9 @@ void ParameterGroup::onToggleSelectedItem() QTreeWidgetItem* sel = currentItem(); if (isItemSelected(sel)) { - if ( isItemExpanded(sel) ) + if (sel->isExpanded()) sel->setExpanded(false); - else if ( sel->childCount() > 0 ) + else if (sel->childCount() > 0) sel->setExpanded(true); } } @@ -997,7 +997,7 @@ QVariant ParameterGroupItem::data ( int column, int role ) const if (role == Qt::DecorationRole) { // The root item should keep its special pixmap if (parent()) { - return treeWidget()->isItemExpanded(this) ? + return this->isExpanded() ? QApplication::style()->standardPixmap(QStyle::SP_DirOpenIcon): QApplication::style()->standardPixmap(QStyle::SP_DirClosedIcon); } From ca327b6f2579e5be6a3c5f910a7441c36b2543ae Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 12:41:41 +0200 Subject: [PATCH 17/46] Qt5: 'bool QTreeWidget::isItemSelected(const QTreeWidgetItem*) const' is deprecated: Use QTreeWidgetItem::isSelected() instead [-Wdeprecated-declarations] --- src/Gui/CallTips.cpp | 2 +- src/Gui/DlgCommandsImp.cpp | 2 +- src/Gui/DlgKeyboardImp.cpp | 2 +- src/Gui/DlgParameterImp.cpp | 22 +++++++++++----------- src/Gui/DlgToolbarsImp.cpp | 10 +++++----- src/Gui/Tree.cpp | 4 ++-- src/Gui/Widgets.cpp | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 0c3490c8c5..64a1e3e5e6 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -696,7 +696,7 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event) void CallTipsList::callTipItemActivated(QListWidgetItem *item) { hide(); - if (!isItemSelected(item)) return; + if (!item->isSelected()) return; QString text = item->text(); QTextCursor cursor = textEdit->textCursor(); diff --git a/src/Gui/DlgCommandsImp.cpp b/src/Gui/DlgCommandsImp.cpp index 4bd6620aa4..d1657159a8 100644 --- a/src/Gui/DlgCommandsImp.cpp +++ b/src/Gui/DlgCommandsImp.cpp @@ -246,7 +246,7 @@ void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro) item->setSizeHint(0, QSize(32, 32)); if (pCmd->getPixmap()) item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap())); - if (ui->commandTreeWidget->isItemSelected(item)) + if (item->isSelected()) onDescription(item); break; } diff --git a/src/Gui/DlgKeyboardImp.cpp b/src/Gui/DlgKeyboardImp.cpp index d6ded6fc92..b25581635d 100644 --- a/src/Gui/DlgKeyboardImp.cpp +++ b/src/Gui/DlgKeyboardImp.cpp @@ -489,7 +489,7 @@ void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro) item->setSizeHint(0, QSize(32, 32)); if (pCmd->getPixmap()) item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap())); - if (ui->commandTreeWidget->isItemSelected(item)) + if (item->isSelected()) ui->textLabelDescription->setText(item->toolTip(1)); break; } diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index bea595d4cb..cc985c264d 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -483,7 +483,7 @@ ParameterGroup::~ParameterGroup() void ParameterGroup::contextMenuEvent ( QContextMenuEvent* event ) { QTreeWidgetItem* item = currentItem(); - if (isItemSelected(item)) + if (item->isSelected()) { expandAct->setEnabled(item->childCount() > 0); // do not allow to import parameters from a non-empty parameter group @@ -513,7 +513,7 @@ void ParameterGroup::keyPressEvent (QKeyEvent* event) void ParameterGroup::onDeleteSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (isItemSelected(sel) && sel->parent()) + if (sel->isSelected() && sel->parent()) { if ( QMessageBox::question(this, tr("Remove group"), tr("Do you really want to remove this parameter group?"), QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape) == @@ -537,7 +537,7 @@ void ParameterGroup::onDeleteSelectedItem() void ParameterGroup::onToggleSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (isItemSelected(sel)) + if (sel->isSelected()) { if (sel->isExpanded()) sel->setExpanded(false); @@ -555,7 +555,7 @@ void ParameterGroup::onCreateSubgroup() if (ok && Gui::validateInput(this, name)) { QTreeWidgetItem* item = currentItem(); - if (isItemSelected(item)) + if (item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -581,7 +581,7 @@ void ParameterGroup::onExportToFile() if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); - if (isItemSelected(item)) + if (item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -597,7 +597,7 @@ void ParameterGroup::onImportFromFile() if ( !file.isEmpty() ) { QTreeWidgetItem* item = currentItem(); - if (isItemSelected(item)) + if (item->isSelected()) { ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; @@ -631,7 +631,7 @@ void ParameterGroup::onImportFromFile() void ParameterGroup::onRenameSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (isItemSelected(sel)) + if (sel->isSelected()) { editItem(sel, 0); } @@ -701,7 +701,7 @@ bool ParameterValue::edit ( const QModelIndex & index, EditTrigger trigger, QEve void ParameterValue::contextMenuEvent ( QContextMenuEvent* event ) { QTreeWidgetItem* item = currentItem(); - if (isItemSelected(item)) + if (item->isSelected()) menuEdit->popup(event->globalPos()); else menuNew->popup(event->globalPos()); @@ -736,7 +736,7 @@ void ParameterValue::resizeEvent(QResizeEvent* event) void ParameterValue::onChangeSelectedItem(QTreeWidgetItem* item, int col) { - if (isItemSelected(item) && col > 0) + if (item->isSelected() && col > 0) { static_cast(item)->changeValue(); } @@ -750,7 +750,7 @@ void ParameterValue::onChangeSelectedItem() void ParameterValue::onDeleteSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (isItemSelected(sel)) + if (sel->isSelected()) { takeTopLevelItem(indexOfTopLevelItem(sel)); static_cast(sel)->removeFromGroup(); @@ -761,7 +761,7 @@ void ParameterValue::onDeleteSelectedItem() void ParameterValue::onRenameSelectedItem() { QTreeWidgetItem* sel = currentItem(); - if (isItemSelected(sel)) + if (sel->isSelected()) { editItem(sel, 0); } diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 8715f23069..e6cb2d8877 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -378,7 +378,7 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked() void DlgCustomToolbars::on_moveActionLeftButton_clicked() { QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem(); - if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) { + if (item && item->parent() && item->isSelected()) { QTreeWidgetItem* parent = item->parent(); int index = parent->indexOfChild(item); parent->takeChild(index); @@ -412,7 +412,7 @@ void DlgCustomToolbars::on_moveActionLeftButton_clicked() void DlgCustomToolbars::on_moveActionUpButton_clicked() { QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem(); - if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) { + if (item && item->parent() && item->isSelected()) { QTreeWidgetItem* parent = item->parent(); int index = parent->indexOfChild(item); if (index > 0) { @@ -450,7 +450,7 @@ void DlgCustomToolbars::on_moveActionUpButton_clicked() void DlgCustomToolbars::on_moveActionDownButton_clicked() { QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem(); - if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) { + if (item && item->parent() && item->isSelected()) { QTreeWidgetItem* parent = item->parent(); int index = parent->indexOfChild(item); if (index < parent->childCount()-1) { @@ -515,7 +515,7 @@ void DlgCustomToolbars::on_newButton_clicked() void DlgCustomToolbars::on_deleteButton_clicked() { QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem(); - if (item && !item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) { + if (item && !item->parent() && item->isSelected()) { int index = ui->toolbarTreeWidget->indexOfTopLevelItem(item); ui->toolbarTreeWidget->takeTopLevelItem(index); removeCustomToolbar(item->text(0)); @@ -531,7 +531,7 @@ void DlgCustomToolbars::on_renameButton_clicked() { bool renamed = false; QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem(); - if (item && !item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) { + if (item && !item->parent() && item->isSelected()) { bool ok; QString old_text = item->text(0); QString text = QInputDialog::getText(this, tr("Rename toolbar"), tr("Toolbar name:"), diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 12f112025e..f82b597f38 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1403,7 +1403,7 @@ void TreeWidget::dragMoveEvent(QDragMoveEvent *event) auto modifier = QApplication::queryKeyboardModifiers(); QTreeWidgetItem* targetItem = itemAt(event->pos()); - if (!targetItem || this->isItemSelected(targetItem)) { + if (!targetItem || targetItem->isSelected()) { leaveEvent(0); event->ignore(); } @@ -1545,7 +1545,7 @@ void TreeWidget::dropEvent(QDropEvent *event) if (!targetItem) return; // one of the source items is also the destination item, that's not allowed - if (this->isItemSelected(targetItem)) + if (targetItem->isSelected()) return; App::Document *thisDoc; diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 88b1d67ef8..02c1d5e50f 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -339,7 +339,7 @@ void ActionSelector::on_removeButton_clicked() void ActionSelector::on_upButton_clicked() { QTreeWidgetItem* item = selectedWidget->currentItem(); - if (item && selectedWidget->isItemSelected(item)) { + if (item && item->isSelected()) { int index = selectedWidget->indexOfTopLevelItem(item); if (index > 0) { selectedWidget->takeTopLevelItem(index); @@ -352,7 +352,7 @@ void ActionSelector::on_upButton_clicked() void ActionSelector::on_downButton_clicked() { QTreeWidgetItem* item = selectedWidget->currentItem(); - if (item && selectedWidget->isItemSelected(item)) { + if (item && item->isSelected()) { int index = selectedWidget->indexOfTopLevelItem(item); if (index < selectedWidget->topLevelItemCount()-1) { selectedWidget->takeTopLevelItem(index); From 891a435c556d250f1b31bc51a2e8e94a57bd26da Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 12:49:57 +0200 Subject: [PATCH 18/46] Qt5: 'static QString Gui::TaskView::TaskWatcherCommands::trUtf8(const char*, const char*, int)' is deprecated [-Wdeprecated-declarations] --- src/Gui/ComboView.cpp | 12 ++++++------ src/Gui/DockWindowManager.cpp | 2 +- src/Gui/PropertyView.cpp | 4 ++-- src/Gui/ReportView.cpp | 8 ++++---- src/Gui/TaskView/TaskWatcher.cpp | 2 +- src/Gui/ToolBoxManager.cpp | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Gui/ComboView.cpp b/src/Gui/ComboView.cpp index 3a2d9bac4a..17c54f7a00 100644 --- a/src/Gui/ComboView.cpp +++ b/src/Gui/ComboView.cpp @@ -73,16 +73,16 @@ ComboView::ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent) // property view prop = new PropertyView(this); splitter->addWidget(prop); - modelIndex = tabs->addTab(splitter,trUtf8("Model")); + modelIndex = tabs->addTab(splitter,tr("Model")); } // task panel taskPanel = new Gui::TaskView::TaskView(this); - taskIndex = tabs->addTab(taskPanel, trUtf8("Tasks")); + taskIndex = tabs->addTab(taskPanel, tr("Tasks")); // task panel //projectView = new Gui::ProjectWidget(this); - //tabs->addTab(projectView, trUtf8("Project")); + //tabs->addTab(projectView, tr("Project")); } ComboView::~ComboView() @@ -137,9 +137,9 @@ void ComboView::showTaskView() void ComboView::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - tabs->setTabText(modelIndex, trUtf8("Model")); - tabs->setTabText(taskIndex, trUtf8("Tasks")); - //tabs->setTabText(2, trUtf8("Project")); + tabs->setTabText(modelIndex, tr("Model")); + tabs->setTabText(taskIndex, tr("Tasks")); + //tabs->setTabText(2, tr("Project")); } DockWindow::changeEvent(e); diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 1ddc4ef5c4..a3b5db25ab 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -154,7 +154,7 @@ QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget, // set object name and window title needed for i18n stuff dw->setObjectName(QLatin1String(name)); - dw->setWindowTitle(QDockWidget::trUtf8(name)); + dw->setWindowTitle(QDockWidget::tr(name)); dw->setFeatures(QDockWidget::AllDockWidgetFeatures); d->_dockedWindows.push_back(dw); diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 0e00d7bf16..ac338f12ae 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -542,8 +542,8 @@ void PropertyView::tabChanged(int index) void PropertyView::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - tabs->setTabText(0, trUtf8("View")); - tabs->setTabText(1, trUtf8("Data")); + tabs->setTabText(0, tr("View")); + tabs->setTabText(1, tr("Data")); } QWidget::changeEvent(e); diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index d073f551ac..207074f782 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -70,7 +70,7 @@ ReportView::ReportView( QWidget* parent ) // create the output window tabOutput = new ReportOutput(); - tabOutput->setWindowTitle(trUtf8("Output")); + tabOutput->setWindowTitle(tr("Output")); tabOutput->setWindowIcon(BitmapFactory().pixmap("MacroEditor")); int output = tabWidget->addTab(tabOutput, tabOutput->windowTitle()); tabWidget->setTabIcon(output, tabOutput->windowIcon()); @@ -78,7 +78,7 @@ ReportView::ReportView( QWidget* parent ) // create the python console tabPython = new PythonConsole(); tabPython->setWordWrapMode(QTextOption::NoWrap); - tabPython->setWindowTitle(trUtf8("Python console")); + tabPython->setWindowTitle(tr("Python console")); tabPython->setWindowIcon(BitmapFactory().iconFromTheme("applications-python")); int python = tabWidget->addTab(tabPython, tabPython->windowTitle()); tabWidget->setTabIcon(python, tabPython->windowIcon()); @@ -102,8 +102,8 @@ void ReportView::changeEvent(QEvent *e) { QWidget::changeEvent(e); if (e->type() == QEvent::LanguageChange) { - tabOutput->setWindowTitle(trUtf8("Output")); - tabPython->setWindowTitle(trUtf8("Python console")); + tabOutput->setWindowTitle(tr("Output")); + tabPython->setWindowTitle(tr("Python console")); for (int i=0; icount();i++) tabWidget->setTabText(i, tabWidget->widget(i)->windowTitle()); } diff --git a/src/Gui/TaskView/TaskWatcher.cpp b/src/Gui/TaskView/TaskWatcher.cpp index d521ec892f..8785208a42 100644 --- a/src/Gui/TaskView/TaskWatcher.cpp +++ b/src/Gui/TaskView/TaskWatcher.cpp @@ -89,7 +89,7 @@ TaskWatcherCommands::TaskWatcherCommands(const char* Filter,const char* commands if (commands) { CommandManager &mgr = Gui::Application::Instance->commandManager(); Gui::TaskView::TaskBox *tb = new Gui::TaskView::TaskBox - (BitmapFactory().pixmap(pixmap), trUtf8(name), true, 0); + (BitmapFactory().pixmap(pixmap), tr(name), true, 0); for (const char** i=commands;*i;i++) { Command *c = mgr.getCommandByName(*i); diff --git a/src/Gui/ToolBoxManager.cpp b/src/Gui/ToolBoxManager.cpp index a4cfb165bc..78cd1c8588 100644 --- a/src/Gui/ToolBoxManager.cpp +++ b/src/Gui/ToolBoxManager.cpp @@ -90,7 +90,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); std::string toolbarName = (*item)->command(); bar->setObjectName(QString::fromLatin1((*item)->command().c_str())); - bar->setWindowTitle(QObject::trUtf8(toolbarName.c_str())); // i18n + bar->setWindowTitle(QObject::tr(toolbarName.c_str())); // i18n _toolBox->addItem( bar, bar->windowTitle() ); QList subitems = (*item)->getItems(); @@ -129,7 +129,7 @@ void ToolBoxManager::retranslate() const // get always the first item widget QWidget* w = _toolBox->widget(i); QByteArray toolbarName = w->objectName().toUtf8(); - w->setWindowTitle(QObject::trUtf8(toolbarName.constData())); + w->setWindowTitle(QObject::tr(toolbarName.constData())); _toolBox->setItemText(i, w->windowTitle()); } } From 623bf3eec067dc7cf3189bf815f43122e997ac32 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:02:01 +0200 Subject: [PATCH 19/46] Qt5: 'void QListWidget::setItemSelected(const QListWidgetItem*, bool)' is deprecated: Use QListWidgetItem::setSelected() instead [-Wdeprecated-declarations] --- src/Gui/CallTips.cpp | 3 ++- src/Gui/TextEdit.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 64a1e3e5e6..a7cf430099 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -143,7 +143,8 @@ void CallTipsList::keyboardSearch(const QString& wordPrefix) } } - setItemSelected(currentItem(), false); + if (currentItem()) + currentItem()->setSelected(false); } void CallTipsList::validateCursor() diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index 8844f08a12..f9f4cc7116 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -518,7 +518,8 @@ void CompletionList::findCurrentWord(const QString& wordPrefix) } } - setItemSelected(currentItem(), false); + if (currentItem()) + currentItem()->setSelected(false); } /** From 1af7a5646fb08c797cec1fe02437a27fb7540f64 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:22:23 +0200 Subject: [PATCH 20/46] Qt5: 'Qt::DropAction QDrag::start(Qt::DropActions)' is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations] --- src/Gui/Widgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 02c1d5e50f..8b4cd8774f 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -101,7 +101,7 @@ void CommandIconView::startDrag (Qt::DropActions supportedActions) drag->setMimeData(mimeData); drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2)); drag->setPixmap(pixmap); - drag->start(Qt::MoveAction); + drag->exec(Qt::MoveAction); } /** From 52b9d6600474f65bdff1d4ad9232c7033f453497 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:24:39 +0200 Subject: [PATCH 21/46] Qt5: 'void QTreeWidgetItem::setTextColor(int, const QColor&)' is deprecated: Use QTreeWidgetItem::setForeground() instead [-Wdeprecated-declarations] --- src/Mod/Test/Gui/UnitTestImp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Test/Gui/UnitTestImp.cpp b/src/Mod/Test/Gui/UnitTestImp.cpp index 3840b24613..0855c93742 100644 --- a/src/Mod/Test/Gui/UnitTestImp.cpp +++ b/src/Mod/Test/Gui/UnitTestImp.cpp @@ -324,7 +324,7 @@ void UnitTestDialog::insertError(const QString& failure, const QString& details) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeViewFailure); item->setText(0,failure); - item->setTextColor(0, Qt::red); + item->setForeground(0, Qt::red); item->setData(0, Qt::UserRole, QVariant(details)); } From 3437bce123a5a8a0756f2330da2a50fae585ad16 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:33:25 +0200 Subject: [PATCH 22/46] Qt5: 'static void QCoreApplication::flush()' is deprecated since Qt 5.9 [-Wdeprecated-declarations] --- src/Mod/Image/Gui/ImageView.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mod/Image/Gui/ImageView.cpp b/src/Mod/Image/Gui/ImageView.cpp index 8010cb8997..33d9ca1e3d 100644 --- a/src/Mod/Image/Gui/ImageView.cpp +++ b/src/Mod/Image/Gui/ImageView.cpp @@ -408,7 +408,9 @@ void ImageView::mouseDoubleClickEvent(QMouseEvent* cEvent) // Mouse move event void ImageView::mouseMoveEvent(QMouseEvent* cEvent) { +#if QT_VERSION < 0x050900 QApplication::flush(); +#endif // Mouse event coordinates are relative to top-left of image view (including toolbar!) // Get current cursor position relative to top-left of image box From 0c1fd45f0da381136b177974bacd6ee9326f85a2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:42:10 +0200 Subject: [PATCH 23/46] Qt5: 'int QImage::byteCount() const' is deprecated since Qt 5.10: Use sizeInBytes [-Wdeprecated-declarations] --- src/Gui/BitmapFactory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index 3fbfbf84a3..32dc01b75f 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -621,7 +621,11 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const size[0] = p.width(); size[1] = p.height(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + int buffersize = static_cast(p.sizeInBytes()); +#else int buffersize = p.byteCount(); +#endif int numcomponents = 0; QVector table = p.colorTable(); if (!table.isEmpty()) { From 9ed9d30338ed44784186391315e5393bc0cd0922 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:52:34 +0200 Subject: [PATCH 24/46] Qt5: 'static bool QPixmapCache::find(const QString&, QPixmap&)' is deprecated: Use bool find(const QString &, QPixmap *) instead [-Wdeprecated-declarations] --- src/Gui/ExpressionBinding.cpp | 2 +- src/Gui/InputField.cpp | 2 +- src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gui/ExpressionBinding.cpp b/src/Gui/ExpressionBinding.cpp index c2be557127..be47e2b77e 100644 --- a/src/Gui/ExpressionBinding.cpp +++ b/src/Gui/ExpressionBinding.cpp @@ -158,7 +158,7 @@ QPixmap ExpressionBinding::getIcon(const char* name, const QSize& size) const .arg(size.width()) .arg(size.height()); QPixmap icon; - if (QPixmapCache::find(key, icon)) + if (QPixmapCache::find(key, &icon)) return icon; icon = BitmapFactory().pixmapFromSvg(name, size); diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index cb5194685e..2b2089e035 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -145,7 +145,7 @@ QPixmap InputField::getValidationIcon(const char* name, const QSize& size) const .arg(size.width()) .arg(size.height()); QPixmap icon; - if (QPixmapCache::find(key, icon)) + if (QPixmapCache::find(key, &icon)) return icon; icon = BitmapFactory().pixmapFromSvg(name, size); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index 4e2a6ca62c..f376e4ad2d 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -380,7 +380,7 @@ protected: .arg(size.width()) .arg(size.height()); QPixmap icon; - if (QPixmapCache::find(key, icon)) + if (QPixmapCache::find(key, &icon)) return icon; icon = Gui::BitmapFactory().pixmapFromSvg(name, size); From 14aa5a602b9a1e82cdf90c4b5995161d2c598f74 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 13:58:01 +0200 Subject: [PATCH 25/46] Qt5: 'static QPixmap QPixmap::grabWidget(QObject*, const QRect&)' is deprecated: Use QWidget::grab() instead [-Wdeprecated-declarations] --- src/Gui/iisTaskPanel/src/iistaskbox.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Gui/iisTaskPanel/src/iistaskbox.cpp b/src/Gui/iisTaskPanel/src/iistaskbox.cpp index a262f63a3a..f60e37f242 100644 --- a/src/Gui/iisTaskPanel/src/iistaskbox.cpp +++ b/src/Gui/iisTaskPanel/src/iistaskbox.cpp @@ -77,7 +77,11 @@ void iisTaskBox::showHide() if (m_foldStep) return; +#if QT_VERSION >= 0x050000 + m_foldPixmap = myGroup->grab(myGroup->rect()); +#else m_foldPixmap = QPixmap::grabWidget(myGroup, myGroup->rect()); +#endif if (myGroup->isVisible()) { m_tempHeight = m_fullHeight = myGroup->height(); From 40dc3ccedd645ecf8eac159604a9d7ef6eb06014 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 14:12:10 +0200 Subject: [PATCH 26/46] Qt5: 'QString QFileInfo::readLink() const' is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations] --- src/Gui/MainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 9bfdc498f8..3812d552f4 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1810,7 +1810,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList& url) QFileInfo info((*it).toLocalFile()); if (info.exists() && info.isFile()) { if (info.isSymLink()) - info.setFile(info.readLink()); + info.setFile(info.symLinkTarget()); std::vector module = App::GetApplication() .getImportModules(info.completeSuffix().toLatin1()); if (module.empty()) { From c319cf169da3e9b8240fbf1f2a4d547738a94f40 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 20:20:55 +0200 Subject: [PATCH 27/46] Py3.8: [skip ci] missing initializer for member '_typeobject::tp_vectorcall' [-Wmissing-field-initializers] --- src/App/FeaturePythonPyImp.inl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/App/FeaturePythonPyImp.inl b/src/App/FeaturePythonPyImp.inl index f9b36edb12..600cfaef04 100644 --- a/src/App/FeaturePythonPyImp.inl +++ b/src/App/FeaturePythonPyImp.inl @@ -84,6 +84,9 @@ PyTypeObject FeaturePythonPyT::Type = { #if PY_MAJOR_VERSION >= 3 ,0 /*tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x03080000 + ,0 /*tp_vectorcall */ +#endif }; template From 867adbe1b57549fcd592361a682440bc123a65e6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 20:29:39 +0200 Subject: [PATCH 28/46] Py3.8: [skip ci] missing initializer for member '_typeobject::tp_vectorcall' [-Wmissing-field-initializers] --- src/App/FeaturePythonPyImp.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/App/FeaturePythonPyImp.h b/src/App/FeaturePythonPyImp.h index 104c16d6d5..04123c020d 100644 --- a/src/App/FeaturePythonPyImp.h +++ b/src/App/FeaturePythonPyImp.h @@ -37,7 +37,28 @@ virtual ~_class_(); \ }; -#if PY_MAJOR_VERSION >= 3 +#if PY_VERSION_HEX >= 0x03080000 +#define PYTHON_TYPE_IMP(_class_, _subclass_) \ + PyTypeObject _class_::Type = { \ + PyVarObject_HEAD_INIT(&PyType_Type, 0) \ + ""#_class_"", \ + sizeof(_class_), \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, \ + ""#_class_"", \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + &_subclass_::Type, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ + }; \ + _class_::_class_(Base::BaseClass *pcObject, PyTypeObject *T) \ + : _subclass_(reinterpret_cast<_subclass_::PointerType>(pcObject), T) \ + { \ + } \ + _class_::~_class_() \ + { \ + } + +#elif PY_MAJOR_VERSION >= 3 #define PYTHON_TYPE_IMP(_class_, _subclass_) \ PyTypeObject _class_::Type = { \ PyVarObject_HEAD_INIT(&PyType_Type, 0) \ From 88fd77b31dbdcb0cfc84dd5a9fb31690a081899a Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 23:17:08 +0200 Subject: [PATCH 29/46] Porting Py3.8/Py3.9: Since Py3.3: 'Py_ssize_t PyUnicode_GetSize(PyObject*)' is deprecated [-Wdeprecated-declarations] Since Py3.9: 'PyObject* PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*)' is deprecated [-Wdeprecated-declarations] Since Py3.9: 'void PyEval_InitThreads()' is deprecated [-Wdeprecated-declarations] --- src/Base/Interpreter.cpp | 8 ++++++++ src/Base/PyTools.c | 12 ++++++++++++ src/CXX/Python3/Objects.hxx | 26 ++++++++++++++++++++++++-- src/CXX/Python3/cxx_extensions.cxx | 4 ++-- src/Gui/OnlineDocumentation.cpp | 8 ++++++++ src/Gui/PythonConsole.cpp | 12 ++++++++++++ src/Gui/WidgetFactory.cpp | 4 ++++ src/Gui/Widgets.cpp | 4 ++++ src/Mod/Part/App/AppPartPy.cpp | 4 ++-- 9 files changed, 76 insertions(+), 6 deletions(-) diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 03b74aee61..338d9b0e48 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -549,7 +549,11 @@ const char* InterpreterSingleton::init(int argc,char *argv[]) " exec(open(activate_this).read(), {'__file__':activate_this})\n" ); } + +#if PY_VERSION_HEX < 0x03090000 PyEval_InitThreads(); +#endif + #if PY_MAJOR_VERSION >= 3 size_t size = argc; wchar_t **_argv = new wchar_t*[size]; @@ -700,7 +704,11 @@ void InterpreterSingleton::runMethod(PyObject *pobject, const char *method, throw TypeError("InterpreterSingleton::RunMethod() wrong arguments"); } +#if PY_VERSION_HEX < 0x03090000 presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */ +#else + presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */ +#endif Py_DECREF(pmeth); Py_DECREF(pargs); diff --git a/src/Base/PyTools.c b/src/Base/PyTools.c index 3dc0a998eb..71785f9b94 100644 --- a/src/Base/PyTools.c +++ b/src/Base/PyTools.c @@ -58,7 +58,11 @@ PP_Run_Method(PyObject *pobject, const char *method, if (PP_DEBUG) /* debug it too? */ presult = PP_Debug_Function(pmeth, pargs); else +#if PY_VERSION_HEX < 0x03090000 presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */ +#else + presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */ +#endif Py_DECREF(pmeth); Py_DECREF(pargs); @@ -133,7 +137,11 @@ PP_Run_Function(const char *modname, const char *funcname, /* load from if (PP_DEBUG && strcmp(modname, "pdb") != 0) /* debug this call? */ presult = PP_Debug_Function(func, args); /* run in pdb; incref'd */ else +#if PY_VERSION_HEX < 0x03090000 presult = PyEval_CallObject(func, args); /* run function; incref'd */ +#else + presult = PyObject_CallObject(func, args); /* run function; incref'd */ +#endif Py_DECREF(func); Py_DECREF(args); /* result may be None */ @@ -185,7 +193,11 @@ PP_Run_Known_Callable(PyObject *object, /* func|class|method */ if (PP_DEBUG) /* debug this call? */ presult = PP_Debug_Function(object, args); /* run in pdb; incref'd */ else +#if PY_VERSION_HEX < 0x03090000 presult = PyEval_CallObject(object, args); /* run function; incref'd */ +#else + presult = PyObject_CallObject(object, args); /* run function; incref'd */ +#endif Py_DECREF(args); /* result may be None */ return PP_Convert_Result(presult, resfmt, cresult); /* convert result to C*/ diff --git a/src/CXX/Python3/Objects.hxx b/src/CXX/Python3/Objects.hxx index 490978ec8d..e5b341a012 100644 --- a/src/CXX/Python3/Objects.hxx +++ b/src/CXX/Python3/Objects.hxx @@ -3164,14 +3164,36 @@ namespace Py // Call with keywords Object apply( const Tuple &args, const Dict &kw ) const { +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9 + PyObject *result = PyObject_Call( ptr(), args.ptr(), kw.ptr() ); +#else PyObject *result = PyEval_CallObjectWithKeywords( ptr(), args.ptr(), kw.ptr() ); +#endif if( result == NULL ) { throw Exception(); } return asObject( result ); } +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9 + Object apply() const + { + PyObject *result = PyObject_CallNoArgs( ptr() ); + return asObject( result ); + } + Object apply( PyObject *pargs ) const + { + if( pargs == 0 ) + { + return apply( Tuple() ); + } + else + { + return apply( Tuple( pargs ) ); + } + } +#else Object apply( PyObject *pargs = 0 ) const { if( pargs == 0 ) @@ -3183,6 +3205,7 @@ namespace Py return apply( Tuple( pargs ) ); } } +#endif }; class PYCXX_EXPORT Module: public Object @@ -3233,8 +3256,7 @@ namespace Py inline Object Object::callMemberFunction( const std::string &function_name ) const { Callable target( getAttr( function_name ) ); - Tuple args( (sequence_index_type)0 ); - return target.apply( args ); + return target.apply(); } inline Object Object::callMemberFunction( const std::string &function_name, const Tuple &args ) const diff --git a/src/CXX/Python3/cxx_extensions.cxx b/src/CXX/Python3/cxx_extensions.cxx index 9ff94612f0..d4e597f5e7 100644 --- a/src/CXX/Python3/cxx_extensions.cxx +++ b/src/CXX/Python3/cxx_extensions.cxx @@ -222,7 +222,7 @@ extern "C" // All the following functions redirect the call from Python // onto the matching virtual function in PythonExtensionBase // -#ifdef PYCXX_PYTHON_2TO3 +#if defined( PYCXX_PYTHON_2TO3 ) && !defined( Py_LIMITED_API ) && PY_MINOR_VERSION <= 7 static int print_handler( PyObject *, FILE *, int ); #endif static PyObject *getattr_handler( PyObject *, char * ); @@ -622,7 +622,7 @@ PythonExtensionBase *getPythonExtensionBase( PyObject *self ) } } -#ifdef PYCXX_PYTHON_2TO3 +#if defined( PYCXX_PYTHON_2TO3 ) && !defined( Py_LIMITED_API ) && PY_MINOR_VERSION <= 7 extern "C" int print_handler( PyObject *self, FILE *fp, int flags ) { try diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index f740e1cdce..5504607948 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -419,7 +419,11 @@ void StdCmdPythonHelp::activated(int iMsg) char szBuf[201]; snprintf(szBuf, 200, "http://localhost:%d", port); PyObject* args = Py_BuildValue("(s)", szBuf); +#if PY_VERSION_HEX < 0x03090000 PyObject* result = PyEval_CallObject(func,args); +#else + PyObject* result = PyObject_CallObject(func,args); +#endif if (result) failed = false; @@ -455,7 +459,11 @@ bool Gui::OpenURLInBrowser(const char * URL) PyObject* func = PyDict_GetItemString(dict, "open"); if (func) { PyObject* args = Py_BuildValue("(s)", URL); +#if PY_VERSION_HEX < 0x03090000 PyObject* result = PyEval_CallObject(func,args); +#else + PyObject* result = PyObject_CallObject(func,args); +#endif if (result) failed = false; diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 21fc9ce5c4..e866055a76 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -141,7 +141,11 @@ InteractiveInterpreter::InteractiveInterpreter() PyObject* func = PyObject_GetAttrString(module, "InteractiveInterpreter"); PyObject* args = Py_BuildValue("()"); d = new InteractiveInterpreterP; +#if PY_VERSION_HEX < 0x03090000 d->interpreter = PyEval_CallObject(func,args); +#else + d->interpreter = PyObject_CallObject(func,args); +#endif Py_DECREF(args); Py_DECREF(func); Py_DECREF(module); @@ -195,7 +199,11 @@ PyObject* InteractiveInterpreter::compile(const char* source) const Base::PyGILStateLocker lock; PyObject* func = PyObject_GetAttrString(d->interpreter, "compile"); PyObject* args = Py_BuildValue("(s)", source); +#if PY_VERSION_HEX < 0x03090000 PyObject* eval = PyEval_CallObject(func,args); // must decref later +#else + PyObject* eval = PyObject_CallObject(func,args); // must decref later +#endif Py_DECREF(args); Py_DECREF(func); @@ -227,7 +235,11 @@ int InteractiveInterpreter::compileCommand(const char* source) const Base::PyGILStateLocker lock; PyObject* func = PyObject_GetAttrString(d->interpreter, "compile"); PyObject* args = Py_BuildValue("(s)", source); +#if PY_VERSION_HEX < 0x03090000 PyObject* eval = PyEval_CallObject(func,args); // must decref later +#else + PyObject* eval = PyObject_CallObject(func,args); // must decref later +#endif Py_DECREF(args); Py_DECREF(func); diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp index c47a76ef42..64da98a726 100644 --- a/src/Gui/WidgetFactory.cpp +++ b/src/Gui/WidgetFactory.cpp @@ -1677,7 +1677,11 @@ void SignalConnect::onExecute() /* Time to call the callback */ arglist = Py_BuildValue("(O)", myResource); +#if PY_VERSION_HEX < 0x03090000 result = PyEval_CallObject(myCallback, arglist); +#else + result = PyObject_CallObject(myCallback, arglist); +#endif Py_XDECREF(result); Py_DECREF(arglist); } diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 8b4cd8774f..158766e2e3 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -850,7 +850,11 @@ void UrlLabel::mouseReleaseEvent (QMouseEvent *) PyObject* func = PyDict_GetItemString(dict, "open"); if (func) { PyObject* args = Py_BuildValue("(s)", (const char*)this->_url.toLatin1()); +#if PY_VERSION_HEX < 0x03090000 PyObject* result = PyEval_CallObject(func,args); +#else + PyObject* result = PyObject_CallObject(func,args); +#endif // decrement the args and module reference Py_XDECREF(result); Py_DECREF(args); diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 6bbee793bb..b4143b1520 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1841,11 +1841,11 @@ private: if (!p) { throw Py::TypeError("** makeWireString can't convert PyString."); } - pysize = PyUnicode_GetSize(p); + pysize = PyUnicode_GetLength(p); unichars = PyUnicode_AS_UNICODE(p); } else if (PyUnicode_Check(intext)) { - pysize = PyUnicode_GetSize(intext); + pysize = PyUnicode_GetLength(intext); unichars = PyUnicode_AS_UNICODE(intext); } else { From 730154a68413f0824a22861c6bc845d9635db193 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 9 Jun 2020 12:55:29 +0200 Subject: [PATCH 30/46] boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated --- .../salomesmesh/src/SMESH/SMESH_Mesh.cpp | 4 +- src/App/Application.cpp | 41 ++++++++-------- src/App/Document.cpp | 2 +- src/App/DocumentObject.cpp | 2 +- src/App/DocumentObserver.cpp | 29 ++++++------ src/App/DocumentObserverPython.cpp | 5 +- src/App/DocumentObserverPython.h | 2 +- src/App/GroupExtension.cpp | 5 +- src/App/Link.cpp | 7 +-- src/App/MergeDocuments.cpp | 7 +-- src/App/PreCompiled.h | 2 +- src/App/PropertyExpressionEngine.cpp | 2 +- src/App/PropertyLinks.cpp | 9 ++-- src/Gui/Action.cpp | 9 ++-- src/Gui/Application.cpp | 29 ++++++------ src/Gui/AutoSaver.cpp | 11 +++-- src/Gui/CommandView.cpp | 5 +- src/Gui/DAGView/DAGModel.cpp | 13 ++--- src/Gui/DAGView/DAGView.cpp | 11 +++-- src/Gui/DlgDisplayPropertiesImp.cpp | 5 +- src/Gui/Document.cpp | 47 ++++++++++--------- src/Gui/DocumentModel.cpp | 27 ++++++----- src/Gui/DocumentObserver.cpp | 32 ++++++------- src/Gui/DocumentObserverPython.cpp | 5 +- src/Gui/DocumentObserverPython.h | 2 +- src/Gui/ExpressionBinding.cpp | 5 +- src/Gui/GraphvizView.cpp | 9 ++-- src/Gui/MDIView.cpp | 5 +- src/Gui/MainWindow.cpp | 2 - src/Gui/ManualAlignment.cpp | 7 +-- src/Gui/MergeDocuments.cpp | 7 +-- src/Gui/Placement.cpp | 6 ++- src/Gui/Placement.h | 1 - src/Gui/PreCompiled.h | 2 +- src/Gui/ProjectView.cpp | 1 - src/Gui/PropertyView.cpp | 21 +++++---- src/Gui/Selection.cpp | 9 ++-- src/Gui/TaskElementColors.cpp | 7 +-- src/Gui/TaskView/TaskAppearance.cpp | 5 +- src/Gui/TaskView/TaskSelectLinkProperty.cpp | 1 - src/Gui/TaskView/TaskView.cpp | 9 ++-- src/Gui/TextDocumentEditorView.cpp | 6 +-- src/Gui/Tree.cpp | 47 ++++++++++--------- src/Gui/ViewProvider.cpp | 2 +- src/Gui/ViewProviderLink.cpp | 2 +- src/Gui/ViewProviderOrigin.cpp | 1 - src/Gui/ViewProviderOriginGroup.cpp | 3 -- src/Gui/ViewProviderOriginGroupExtension.cpp | 12 +++-- src/Gui/ViewProviderPart.cpp | 2 +- src/Gui/ViewProviderPythonFeature.cpp | 9 ++-- src/Gui/ViewProviderTextDocument.cpp | 2 +- .../App/opendcm/core/imp/clustergraph_imp.hpp | 8 ++-- .../App/opendcm/module3d/imp/module_imp.hpp | 5 +- .../App/opendcm/moduleShape3d/generator.hpp | 7 +-- .../Assembly/Gui/TaskAssemblyConstraints.cpp | 1 - src/Mod/Assembly/Gui/Workbench.cpp | 20 ++++---- src/Mod/Drawing/Gui/TaskOrthoViews.cpp | 7 +-- src/Mod/Fem/Gui/PreCompiled.h | 2 +- src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 2 +- .../Fem/Gui/ViewProviderFemPostFunction.cpp | 5 +- src/Mod/Inspection/App/InspectionFeature.cpp | 5 +- src/Mod/Mesh/App/Core/Curvature.cpp | 5 +- src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp | 2 - src/Mod/Mesh/Gui/MeshEditor.cpp | 5 +- src/Mod/Mesh/Gui/ViewProvider.cpp | 10 ++-- src/Mod/MeshPart/Gui/CrossSections.cpp | 5 +- src/Mod/Part/App/PartFeature.cpp | 9 ++-- src/Mod/Part/App/PreCompiled.h | 2 +- src/Mod/Part/Gui/CrossSections.cpp | 5 +- src/Mod/Part/Gui/DlgBooleanOperation.cpp | 7 +-- src/Mod/Part/Gui/DlgFilletEdges.cpp | 7 +-- src/Mod/Part/Gui/Mirroring.cpp | 1 - src/Mod/Part/Gui/PreCompiled.h | 2 +- src/Mod/Part/Gui/TaskAttacher.cpp | 7 +-- src/Mod/Part/Gui/TaskDimension.cpp | 6 ++- src/Mod/Part/Gui/TaskFaceColors.cpp | 9 ++-- src/Mod/Part/Gui/ViewProviderSpline.cpp | 5 +- src/Mod/PartDesign/App/Body.cpp | 1 - src/Mod/PartDesign/App/ShapeBinder.cpp | 7 +-- src/Mod/PartDesign/Gui/PreCompiled.h | 2 +- .../PartDesign/Gui/TaskDatumParameters.cpp | 1 - src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 5 +- src/Mod/PartDesign/Gui/TaskHoleParameters.h | 2 +- .../Gui/TaskPrimitiveParameters.cpp | 2 - .../Gui/TaskTransformedMessages.cpp | 5 +- src/Mod/PartDesign/Gui/ViewProviderBody.cpp | 7 +-- src/Mod/PartDesign/Gui/Workbench.cpp | 23 ++++----- src/Mod/PartDesign/Gui/WorkflowManager.cpp | 9 ++-- src/Mod/Path/App/Area.cpp | 3 ++ src/Mod/Path/libarea/PythonStuff.cpp | 6 ++- .../ReverseEngineering/App/ApproxSurface.cpp | 5 +- src/Mod/Sandbox/App/DocumentProtector.h | 1 - src/Mod/Sandbox/Gui/Command.cpp | 6 ++- src/Mod/Sandbox/Gui/TaskPanelView.cpp | 15 +++--- src/Mod/Sketcher/App/PreCompiled.h | 2 +- src/Mod/Sketcher/App/SketchObject.cpp | 9 ++-- src/Mod/Sketcher/Gui/PreCompiled.h | 2 +- src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp | 7 +-- .../Sketcher/Gui/TaskSketcherConstrains.cpp | 2 +- src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 2 +- src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp | 5 +- src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp | 7 +-- .../Gui/TaskSketcherSolverAdvanced.cpp | 1 - src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 7 +-- src/Mod/Spreadsheet/App/PropertySheet.cpp | 11 +++-- src/Mod/Spreadsheet/App/Sheet.cpp | 1 - src/Mod/Spreadsheet/Gui/SheetModel.cpp | 5 +- src/Mod/Spreadsheet/Gui/SheetTableView.cpp | 5 +- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 7 +-- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 5 +- .../TechDraw/Gui/ViewProviderDrawingView.cpp | 5 +- src/Mod/TechDraw/Gui/ViewProviderPage.cpp | 13 ++--- 112 files changed, 451 insertions(+), 390 deletions(-) diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp index bb278f8275..7ab201cef9 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp @@ -76,10 +76,10 @@ #ifndef WIN32 #include -#include +#include #else #include -#include +#include //#include #endif diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 734894c1d5..b7f1072afb 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -122,7 +122,7 @@ #include #include -#include +#include #include #include #include @@ -131,6 +131,7 @@ using namespace App; using namespace std; using namespace boost; using namespace boost::program_options; +namespace bp = boost::placeholders; // scriptings (scripts are built-in but can be overridden by command line option) @@ -413,26 +414,26 @@ Document* Application::newDocument(const char * Name, const char * UserName, boo // connect the signals to the application for the new document - _pActiveDoc->signalBeforeChange.connect(boost::bind(&App::Application::slotBeforeChangeDocument, this, _1, _2)); - _pActiveDoc->signalChanged.connect(boost::bind(&App::Application::slotChangedDocument, this, _1, _2)); - _pActiveDoc->signalNewObject.connect(boost::bind(&App::Application::slotNewObject, this, _1)); - _pActiveDoc->signalDeletedObject.connect(boost::bind(&App::Application::slotDeletedObject, this, _1)); - _pActiveDoc->signalBeforeChangeObject.connect(boost::bind(&App::Application::slotBeforeChangeObject, this, _1, _2)); - _pActiveDoc->signalChangedObject.connect(boost::bind(&App::Application::slotChangedObject, this, _1, _2)); - _pActiveDoc->signalRelabelObject.connect(boost::bind(&App::Application::slotRelabelObject, this, _1)); - _pActiveDoc->signalActivatedObject.connect(boost::bind(&App::Application::slotActivatedObject, this, _1)); - _pActiveDoc->signalUndo.connect(boost::bind(&App::Application::slotUndoDocument, this, _1)); - _pActiveDoc->signalRedo.connect(boost::bind(&App::Application::slotRedoDocument, this, _1)); - _pActiveDoc->signalRecomputedObject.connect(boost::bind(&App::Application::slotRecomputedObject, this, _1)); - _pActiveDoc->signalRecomputed.connect(boost::bind(&App::Application::slotRecomputed, this, _1)); - _pActiveDoc->signalBeforeRecompute.connect(boost::bind(&App::Application::slotBeforeRecompute, this, _1)); - _pActiveDoc->signalOpenTransaction.connect(boost::bind(&App::Application::slotOpenTransaction, this, _1, _2)); - _pActiveDoc->signalCommitTransaction.connect(boost::bind(&App::Application::slotCommitTransaction, this, _1)); - _pActiveDoc->signalAbortTransaction.connect(boost::bind(&App::Application::slotAbortTransaction, this, _1)); - _pActiveDoc->signalStartSave.connect(boost::bind(&App::Application::slotStartSaveDocument, this, _1, _2)); - _pActiveDoc->signalFinishSave.connect(boost::bind(&App::Application::slotFinishSaveDocument, this, _1, _2)); + _pActiveDoc->signalBeforeChange.connect(boost::bind(&App::Application::slotBeforeChangeDocument, this, bp::_1, bp::_2)); + _pActiveDoc->signalChanged.connect(boost::bind(&App::Application::slotChangedDocument, this, bp::_1, bp::_2)); + _pActiveDoc->signalNewObject.connect(boost::bind(&App::Application::slotNewObject, this, bp::_1)); + _pActiveDoc->signalDeletedObject.connect(boost::bind(&App::Application::slotDeletedObject, this, bp::_1)); + _pActiveDoc->signalBeforeChangeObject.connect(boost::bind(&App::Application::slotBeforeChangeObject, this, bp::_1, bp::_2)); + _pActiveDoc->signalChangedObject.connect(boost::bind(&App::Application::slotChangedObject, this, bp::_1, bp::_2)); + _pActiveDoc->signalRelabelObject.connect(boost::bind(&App::Application::slotRelabelObject, this, bp::_1)); + _pActiveDoc->signalActivatedObject.connect(boost::bind(&App::Application::slotActivatedObject, this, bp::_1)); + _pActiveDoc->signalUndo.connect(boost::bind(&App::Application::slotUndoDocument, this, bp::_1)); + _pActiveDoc->signalRedo.connect(boost::bind(&App::Application::slotRedoDocument, this, bp::_1)); + _pActiveDoc->signalRecomputedObject.connect(boost::bind(&App::Application::slotRecomputedObject, this, bp::_1)); + _pActiveDoc->signalRecomputed.connect(boost::bind(&App::Application::slotRecomputed, this, bp::_1)); + _pActiveDoc->signalBeforeRecompute.connect(boost::bind(&App::Application::slotBeforeRecompute, this, bp::_1)); + _pActiveDoc->signalOpenTransaction.connect(boost::bind(&App::Application::slotOpenTransaction, this, bp::_1, bp::_2)); + _pActiveDoc->signalCommitTransaction.connect(boost::bind(&App::Application::slotCommitTransaction, this, bp::_1)); + _pActiveDoc->signalAbortTransaction.connect(boost::bind(&App::Application::slotAbortTransaction, this, bp::_1)); + _pActiveDoc->signalStartSave.connect(boost::bind(&App::Application::slotStartSaveDocument, this, bp::_1, bp::_2)); + _pActiveDoc->signalFinishSave.connect(boost::bind(&App::Application::slotFinishSaveDocument, this, bp::_1, bp::_2)); _pActiveDoc->signalChangePropertyEditor.connect( - boost::bind(&App::Application::slotChangePropertyEditor, this, _1, _2)); + boost::bind(&App::Application::slotChangePropertyEditor, this, bp::_1, bp::_2)); // make sure that the active document is set in case no GUI is up { diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 7245308c08..e3a6ae1eee 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -82,7 +82,7 @@ recompute path. Also, it enables more complicated dependencies beyond trees. #include #endif //USE_OLD_DAG -#include +#include #include #include #include diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index a3e88e9f35..ed51e299c2 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -42,7 +42,7 @@ #include "DocumentObjectExtension.h" #include "GeoFeatureGroupExtension.h" #include -#include +#include FC_LOG_LEVEL_INIT("App",true,true) diff --git a/src/App/DocumentObserver.cpp b/src/App/DocumentObserver.cpp index 299527d838..02769abcb3 100644 --- a/src/App/DocumentObserver.cpp +++ b/src/App/DocumentObserver.cpp @@ -27,7 +27,7 @@ # include #endif -#include +#include #include #include "Application.h" @@ -38,6 +38,7 @@ #include "GeoFeature.h" using namespace App; +namespace bp = boost::placeholders; DocumentT::DocumentT() @@ -400,7 +401,7 @@ public: Private(App::Document* doc) : _document(doc) { if (doc) { connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind - (&Private::deletedDocument, this, _1)); + (&Private::deletedDocument, this, bp::_1)); } } @@ -478,12 +479,12 @@ public: if (obj) { indocument = true; connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind - (&Private::deletedDocument, this, _1)); + (&Private::deletedDocument, this, bp::_1)); App::Document* doc = obj->getDocument(); connectDocumentCreatedObject = doc->signalNewObject.connect(boost::bind - (&Private::createdObject, this, _1)); + (&Private::createdObject, this, bp::_1)); connectDocumentDeletedObject = doc->signalDeletedObject.connect(boost::bind - (&Private::deletedObject, this, _1)); + (&Private::deletedObject, this, bp::_1)); } } App::DocumentObject* get() const noexcept { @@ -550,18 +551,18 @@ bool DocumentObjectWeakPtrT::operator!= (const DocumentObjectWeakPtrT& p) const DocumentObserver::DocumentObserver() : _document(nullptr) { this->connectApplicationCreatedDocument = App::GetApplication().signalNewDocument.connect(boost::bind - (&DocumentObserver::slotCreatedDocument, this, _1)); + (&DocumentObserver::slotCreatedDocument, this, bp::_1)); this->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind - (&DocumentObserver::slotDeletedDocument, this, _1)); + (&DocumentObserver::slotDeletedDocument, this, bp::_1)); } DocumentObserver::DocumentObserver(Document* doc) : _document(nullptr) { // Connect to application and given document this->connectApplicationCreatedDocument = App::GetApplication().signalNewDocument.connect(boost::bind - (&DocumentObserver::slotCreatedDocument, this, _1)); + (&DocumentObserver::slotCreatedDocument, this, bp::_1)); this->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind - (&DocumentObserver::slotDeletedDocument, this, _1)); + (&DocumentObserver::slotDeletedDocument, this, bp::_1)); attachDocument(doc); } @@ -585,15 +586,15 @@ void DocumentObserver::attachDocument(Document* doc) _document = doc; this->connectDocumentCreatedObject = _document->signalNewObject.connect(boost::bind - (&DocumentObserver::slotCreatedObject, this, _1)); + (&DocumentObserver::slotCreatedObject, this, bp::_1)); this->connectDocumentDeletedObject = _document->signalDeletedObject.connect(boost::bind - (&DocumentObserver::slotDeletedObject, this, _1)); + (&DocumentObserver::slotDeletedObject, this, bp::_1)); this->connectDocumentChangedObject = _document->signalChangedObject.connect(boost::bind - (&DocumentObserver::slotChangedObject, this, _1, _2)); + (&DocumentObserver::slotChangedObject, this, bp::_1, bp::_2)); this->connectDocumentRecomputedObject = _document->signalRecomputedObject.connect(boost::bind - (&DocumentObserver::slotRecomputedObject, this, _1)); + (&DocumentObserver::slotRecomputedObject, this, bp::_1)); this->connectDocumentRecomputed = _document->signalRecomputed.connect(boost::bind - (&DocumentObserver::slotRecomputedDocument, this, _1)); + (&DocumentObserver::slotRecomputedDocument, this, bp::_1)); } } diff --git a/src/App/DocumentObserverPython.cpp b/src/App/DocumentObserverPython.cpp index 40b74d447f..a4baa273e2 100644 --- a/src/App/DocumentObserverPython.cpp +++ b/src/App/DocumentObserverPython.cpp @@ -34,6 +34,7 @@ #include using namespace App; +namespace bp = boost::placeholders; std::vector DocumentObserverPython::_instances; @@ -72,7 +73,7 @@ DocumentObserverPython::DocumentObserverPython(const Py::Object& obj) : inst(obj FC_PY_GetCallable(obj.ptr(), "slot" #_name1, py##_name1.py);\ if (!py##_name1.py.isNone())\ py##_name1.slot = App::GetApplication().signal##_name2.connect(\ - boost::bind(&DocumentObserverPython::slot##_name1, this, _1));\ + boost::bind(&DocumentObserverPython::slot##_name1, this, bp::_1));\ }\ while(0); @@ -80,7 +81,7 @@ DocumentObserverPython::DocumentObserverPython(const Py::Object& obj) : inst(obj FC_PY_GetCallable(obj.ptr(), "slot" #_name1, py##_name1.py);\ if (!py##_name1.py.isNone())\ py##_name1.slot = App::GetApplication().signal##_name2.connect(\ - boost::bind(&DocumentObserverPython::slot##_name1, this, _1, _2));\ + boost::bind(&DocumentObserverPython::slot##_name1, this, bp::_1, bp::_2));\ }\ while(0); diff --git a/src/App/DocumentObserverPython.h b/src/App/DocumentObserverPython.h index b6e36b92cb..9b94bb5b82 100644 --- a/src/App/DocumentObserverPython.h +++ b/src/App/DocumentObserverPython.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index b83dc5aaf5..8c88060924 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include "DocumentObjectGroup.h" @@ -37,6 +37,7 @@ #include using namespace App; +namespace bp = boost::placeholders; EXTENSION_PROPERTY_SOURCE(App::GroupExtension, App::DocumentObjectExtension) @@ -362,7 +363,7 @@ void GroupExtension::extensionOnChanged(const Property* p) { for(auto obj : Group.getValue()) { if(obj && obj->getNameInDocument()) { _Conns[obj] = obj->signalChanged.connect(boost::bind( - &GroupExtension::slotChildChanged,this,_1,_2)); + &GroupExtension::slotChildChanged,this,bp::_1, bp::_2)); } } } diff --git a/src/App/Link.cpp b/src/App/Link.cpp index 41f519dab1..03514c6516 100644 --- a/src/App/Link.cpp +++ b/src/App/Link.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include @@ -47,6 +47,7 @@ FC_LOG_LEVEL_INIT("App::Link", true,true) using namespace App; using namespace Base; +namespace bp = boost::placeholders; EXTENSION_PROPERTY_SOURCE(App::LinkBaseExtension, App::DocumentObjectExtension) @@ -820,7 +821,7 @@ void LinkBaseExtension::updateGroup() { FC_LOG("new group connection " << getExtendedObject()->getFullName() << " -> " << group->getFullName()); conn = group->signalChanged.connect( - boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,_1,_2)); + boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,bp::_1,bp::_2)); } std::size_t count = children.size(); ext->getAllChildren(children,childSet); @@ -834,7 +835,7 @@ void LinkBaseExtension::updateGroup() { FC_LOG("new group connection " << getExtendedObject()->getFullName() << " -> " << child->getFullName()); conn = child->signalChanged.connect( - boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,_1,_2)); + boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,bp::_1,bp::_2)); } } } diff --git a/src/App/MergeDocuments.cpp b/src/App/MergeDocuments.cpp index 101c46d2b2..1893383e8e 100644 --- a/src/App/MergeDocuments.cpp +++ b/src/App/MergeDocuments.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include #endif #include @@ -36,6 +36,7 @@ #include using namespace App; +namespace bp = boost::placeholders; namespace App { @@ -127,9 +128,9 @@ private: MergeDocuments::MergeDocuments(App::Document* doc) : guiup(false), verbose(true), stream(0), appdoc(doc) { connectExport = doc->signalExportObjects.connect - (boost::bind(&MergeDocuments::exportObject, this, _1, _2)); + (boost::bind(&MergeDocuments::exportObject, this, bp::_1, bp::_2)); connectImport = doc->signalImportObjects.connect - (boost::bind(&MergeDocuments::importObject, this, _1, _2)); + (boost::bind(&MergeDocuments::importObject, this, bp::_1, bp::_2)); QCoreApplication* app = QCoreApplication::instance(); if (app && app->inherits("QApplication")) { diff --git a/src/App/PreCompiled.h b/src/App/PreCompiled.h index f0df5df04b..4a2596c297 100644 --- a/src/App/PreCompiled.h +++ b/src/App/PreCompiled.h @@ -79,7 +79,7 @@ // Boost #include -#include +#include #include #include diff --git a/src/App/PropertyExpressionEngine.cpp b/src/App/PropertyExpressionEngine.cpp index caf11ebad8..b380624599 100644 --- a/src/App/PropertyExpressionEngine.cpp +++ b/src/App/PropertyExpressionEngine.cpp @@ -34,7 +34,7 @@ #include "PropertyStandard.h" #include "PropertyUnits.h" #include -#include +#include #include #include diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 9bf02712b7..6cb8ae1371 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include /// Here the FreeCAD includes sorted by Base,App,Gui...... #include @@ -55,6 +55,7 @@ FC_LOG_LEVEL_INIT("PropertyLinks",true,true) using namespace App; using namespace Base; using namespace std; +namespace bp = boost::placeholders; //************************************************************************** //************************************************************************** @@ -2573,11 +2574,11 @@ public: myPath = myPos->first.toUtf8().constData(); App::Application &app = App::GetApplication(); connFinishRestoreDocument = app.signalFinishRestoreDocument.connect( - boost::bind(&DocInfo::slotFinishRestoreDocument,this,_1)); + boost::bind(&DocInfo::slotFinishRestoreDocument,this,bp::_1)); connDeleteDocument = app.signalDeleteDocument.connect( - boost::bind(&DocInfo::slotDeleteDocument,this,_1)); + boost::bind(&DocInfo::slotDeleteDocument,this,bp::_1)); connSaveDocument = app.signalSaveDocument.connect( - boost::bind(&DocInfo::slotSaveDocument,this,_1)); + boost::bind(&DocInfo::slotSaveDocument,this,bp::_1)); QString fullpath(getFullPath()); if(fullpath.isEmpty()) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 8ec6691451..a75bf5df68 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include # include # include # include @@ -55,6 +55,7 @@ using namespace Gui; using namespace Gui::Dialog; +namespace bp = boost::placeholders; /** * Constructs an action called \a name with parent \a parent. It also stores a pointer @@ -522,9 +523,9 @@ WorkbenchGroup::WorkbenchGroup ( Command* pcCmd, QObject * parent ) action->setData(QVariant(i)); // set the index } - Application::Instance->signalActivateWorkbench.connect(boost::bind(&WorkbenchGroup::slotActivateWorkbench, this, _1)); - Application::Instance->signalAddWorkbench.connect(boost::bind(&WorkbenchGroup::slotAddWorkbench, this, _1)); - Application::Instance->signalRemoveWorkbench.connect(boost::bind(&WorkbenchGroup::slotRemoveWorkbench, this, _1)); + Application::Instance->signalActivateWorkbench.connect(boost::bind(&WorkbenchGroup::slotActivateWorkbench, this, bp::_1)); + Application::Instance->signalAddWorkbench.connect(boost::bind(&WorkbenchGroup::slotAddWorkbench, this, bp::_1)); + Application::Instance->signalRemoveWorkbench.connect(boost::bind(&WorkbenchGroup::slotRemoveWorkbench, this, bp::_1)); } WorkbenchGroup::~WorkbenchGroup() diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index e98facc16a..121127d5ad 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -26,7 +26,7 @@ #ifndef _PreComp_ # include "InventorAll.h" # include -# include +# include # include # include # include @@ -137,6 +137,7 @@ using namespace Gui; using namespace Gui::DockWnd; using namespace std; +namespace bp = boost::placeholders; Application* Application::Instance = 0L; @@ -294,12 +295,12 @@ Application::Application(bool GUIenabled) { //App::GetApplication().Attach(this); if (GUIenabled) { - App::GetApplication().signalNewDocument.connect(boost::bind(&Gui::Application::slotNewDocument, this, _1, _2)); - App::GetApplication().signalDeleteDocument.connect(boost::bind(&Gui::Application::slotDeleteDocument, this, _1)); - App::GetApplication().signalRenameDocument.connect(boost::bind(&Gui::Application::slotRenameDocument, this, _1)); - App::GetApplication().signalActiveDocument.connect(boost::bind(&Gui::Application::slotActiveDocument, this, _1)); - App::GetApplication().signalRelabelDocument.connect(boost::bind(&Gui::Application::slotRelabelDocument, this, _1)); - App::GetApplication().signalShowHidden.connect(boost::bind(&Gui::Application::slotShowHidden, this, _1)); + App::GetApplication().signalNewDocument.connect(boost::bind(&Gui::Application::slotNewDocument, this, bp::_1, bp::_2)); + App::GetApplication().signalDeleteDocument.connect(boost::bind(&Gui::Application::slotDeleteDocument, this, bp::_1)); + App::GetApplication().signalRenameDocument.connect(boost::bind(&Gui::Application::slotRenameDocument, this, bp::_1)); + App::GetApplication().signalActiveDocument.connect(boost::bind(&Gui::Application::slotActiveDocument, this, bp::_1)); + App::GetApplication().signalRelabelDocument.connect(boost::bind(&Gui::Application::slotRelabelDocument, this, bp::_1)); + App::GetApplication().signalShowHidden.connect(boost::bind(&Gui::Application::slotShowHidden, this, bp::_1)); // install the last active language @@ -717,13 +718,13 @@ void Application::slotNewDocument(const App::Document& Doc, bool isMainDoc) d->documents[&Doc] = pDoc; // connect the signals to the application for the new document - pDoc->signalNewObject.connect(boost::bind(&Gui::Application::slotNewObject, this, _1)); - pDoc->signalDeletedObject.connect(boost::bind(&Gui::Application::slotDeletedObject, this, _1)); - pDoc->signalChangedObject.connect(boost::bind(&Gui::Application::slotChangedObject, this, _1, _2)); - pDoc->signalRelabelObject.connect(boost::bind(&Gui::Application::slotRelabelObject, this, _1)); - pDoc->signalActivatedObject.connect(boost::bind(&Gui::Application::slotActivatedObject, this, _1)); - pDoc->signalInEdit.connect(boost::bind(&Gui::Application::slotInEdit, this, _1)); - pDoc->signalResetEdit.connect(boost::bind(&Gui::Application::slotResetEdit, this, _1)); + pDoc->signalNewObject.connect(boost::bind(&Gui::Application::slotNewObject, this, bp::_1)); + pDoc->signalDeletedObject.connect(boost::bind(&Gui::Application::slotDeletedObject, this, bp::_1)); + pDoc->signalChangedObject.connect(boost::bind(&Gui::Application::slotChangedObject, this, bp::_1, bp::_2)); + pDoc->signalRelabelObject.connect(boost::bind(&Gui::Application::slotRelabelObject, this, bp::_1)); + pDoc->signalActivatedObject.connect(boost::bind(&Gui::Application::slotActivatedObject, this, bp::_1)); + pDoc->signalInEdit.connect(boost::bind(&Gui::Application::slotInEdit, this, bp::_1)); + pDoc->signalResetEdit.connect(boost::bind(&Gui::Application::slotResetEdit, this, bp::_1)); signalNewDocument(*pDoc, isMainDoc); if(isMainDoc) diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index 9343d9cd35..ac93acb54e 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -30,7 +30,7 @@ # include # include # include -# include +# include # include #endif @@ -53,14 +53,15 @@ FC_LOG_LEVEL_INIT("App",true,true) using namespace Gui; +namespace bp = boost::placeholders; AutoSaver* AutoSaver::self = 0; AutoSaver::AutoSaver(QObject* parent) : QObject(parent), timeout(900000), compressed(true) { - App::GetApplication().signalNewDocument.connect(boost::bind(&AutoSaver::slotCreateDocument, this, _1)); - App::GetApplication().signalDeleteDocument.connect(boost::bind(&AutoSaver::slotDeleteDocument, this, _1)); + App::GetApplication().signalNewDocument.connect(boost::bind(&AutoSaver::slotCreateDocument, this, bp::_1)); + App::GetApplication().signalDeleteDocument.connect(boost::bind(&AutoSaver::slotDeleteDocument, this, bp::_1)); } AutoSaver::~AutoSaver() @@ -242,9 +243,9 @@ void AutoSaver::timerEvent(QTimerEvent * event) AutoSaveProperty::AutoSaveProperty(const App::Document* doc) : timerId(-1) { documentNew = const_cast(doc)->signalNewObject.connect - (boost::bind(&AutoSaveProperty::slotNewObject, this, _1)); + (boost::bind(&AutoSaveProperty::slotNewObject, this, bp::_1)); documentMod = const_cast(doc)->signalChangedObject.connect - (boost::bind(&AutoSaveProperty::slotChangePropertyData, this, _2)); + (boost::bind(&AutoSaveProperty::slotChangePropertyData, this, bp::_2)); } AutoSaveProperty::~AutoSaveProperty() diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 037299271a..b9327c41fb 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -39,7 +39,7 @@ # include # include # include -# include +# include #endif #include "Command.h" @@ -93,6 +93,7 @@ using namespace Gui; using Gui::Dialog::DlgSettingsImageImp; +namespace bp = boost::placeholders; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -585,7 +586,7 @@ StdCmdDrawStyle::StdCmdDrawStyle() sPixmap = "DrawStyleAsIs"; eType = Alter3DView; - this->getGuiApplication()->signalActivateView.connect(boost::bind(&StdCmdDrawStyle::updateIcon, this, _1)); + this->getGuiApplication()->signalActivateView.connect(boost::bind(&StdCmdDrawStyle::updateIcon, this, bp::_1)); } Gui::Action * StdCmdDrawStyle::createAction(void) diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index e4bb87c1a5..88376d1b7e 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include +#include #include #include @@ -64,6 +64,7 @@ using namespace Gui; using namespace DAG; +namespace bp = boost::placeholders; LineEdit::LineEdit(QWidget* parentIn): QLineEdit(parentIn) { @@ -145,11 +146,11 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen connect(this->editingFinishedAction, SIGNAL(triggered()), this, SLOT(editingFinishedSlot())); - connectNewObject = documentIn.signalNewObject.connect(boost::bind(&Model::slotNewObject, this, _1)); - connectDelObject = documentIn.signalDeletedObject.connect(boost::bind(&Model::slotDeleteObject, this, _1)); - connectChgObject = documentIn.signalChangedObject.connect(boost::bind(&Model::slotChangeObject, this, _1, _2)); - connectEdtObject = documentIn.signalInEdit.connect(boost::bind(&Model::slotInEdit, this, _1)); - connectResObject = documentIn.signalResetEdit.connect(boost::bind(&Model::slotResetEdit, this, _1)); + connectNewObject = documentIn.signalNewObject.connect(boost::bind(&Model::slotNewObject, this, bp::_1)); + connectDelObject = documentIn.signalDeletedObject.connect(boost::bind(&Model::slotDeleteObject, this, bp::_1)); + connectChgObject = documentIn.signalChangedObject.connect(boost::bind(&Model::slotChangeObject, this, bp::_1, bp::_2)); + connectEdtObject = documentIn.signalInEdit.connect(boost::bind(&Model::slotInEdit, this, bp::_1)); + connectResObject = documentIn.signalResetEdit.connect(boost::bind(&Model::slotResetEdit, this, bp::_1)); for (auto obj : documentIn.getDocument()->getObjects()) { auto vpd = Base::freecad_dynamic_cast(documentIn.getViewProvider(obj)); diff --git a/src/Gui/DAGView/DAGView.cpp b/src/Gui/DAGView/DAGView.cpp index e0f11e0bfd..2c73d99d97 100644 --- a/src/Gui/DAGView/DAGView.cpp +++ b/src/Gui/DAGView/DAGView.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include +#include #include #include #endif @@ -42,6 +42,7 @@ using namespace Gui; using namespace DAG; +namespace bp = boost::placeholders; DAG::DockWindow::DockWindow(Gui::Document* gDocumentIn, QWidget* parent): Gui::DockWindow(gDocumentIn, parent) { @@ -55,8 +56,8 @@ View::View(QWidget* parentIn): QGraphicsView(parentIn) { this->setRenderHint(QPainter::Antialiasing, true); this->setRenderHint(QPainter::TextAntialiasing, true); - Application::Instance->signalActiveDocument.connect(boost::bind(&View::slotActiveDocument, this, _1)); - Application::Instance->signalDeleteDocument.connect(boost::bind(&View::slotDeleteDocument, this, _1)); + Application::Instance->signalActiveDocument.connect(boost::bind(&View::slotActiveDocument, this, bp::_1)); + Application::Instance->signalDeleteDocument.connect(boost::bind(&View::slotDeleteDocument, this, bp::_1)); //just update the dagview when the gui process is idle. connect(QAbstractEventDispatcher::instance(), SIGNAL(awake()), this, SLOT(awakeSlot())); @@ -64,8 +65,8 @@ View::View(QWidget* parentIn): QGraphicsView(parentIn) View::~View() { - Application::Instance->signalActiveDocument.disconnect(boost::bind(&View::slotActiveDocument, this, _1)); - Application::Instance->signalDeleteDocument.disconnect(boost::bind(&View::slotDeleteDocument, this, _1)); + Application::Instance->signalActiveDocument.disconnect(boost::bind(&View::slotActiveDocument, this, bp::_1)); + Application::Instance->signalDeleteDocument.disconnect(boost::bind(&View::slotDeleteDocument, this, bp::_1)); } void View::slotActiveDocument(const Document &documentIn) diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index 151f653714..d5961b35a3 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include # include # include #endif @@ -51,6 +51,7 @@ using namespace Gui::Dialog; using namespace std; +namespace bp = boost::placeholders; /* TRANSLATOR Gui::Dialog::DlgDisplayPropertiesImp */ @@ -111,7 +112,7 @@ DlgDisplayPropertiesImp::DlgDisplayPropertiesImp(bool floating, QWidget* parent, d->connectChangedObject = Gui::Application::Instance->signalChangedObject.connect(boost::bind - (&DlgDisplayPropertiesImp::slotChangedObject, this, _1, _2)); + (&DlgDisplayPropertiesImp::slotChangedObject, this, bp::_1, bp::_2)); } /** diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index f5b6d87679..b36b184557 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -33,7 +33,7 @@ # include # include # include -# include +# include # include # include #endif @@ -75,6 +75,7 @@ FC_LOG_LEVEL_INIT("Gui",true,true) using namespace Gui; +namespace bp = boost::placeholders; namespace Gui { @@ -165,54 +166,54 @@ Document::Document(App::Document* pcDocument,Application * app) // Setup the connections d->connectNewObject = pcDocument->signalNewObject.connect - (boost::bind(&Gui::Document::slotNewObject, this, _1)); + (boost::bind(&Gui::Document::slotNewObject, this, bp::_1)); d->connectDelObject = pcDocument->signalDeletedObject.connect - (boost::bind(&Gui::Document::slotDeletedObject, this, _1)); + (boost::bind(&Gui::Document::slotDeletedObject, this, bp::_1)); d->connectCngObject = pcDocument->signalChangedObject.connect - (boost::bind(&Gui::Document::slotChangedObject, this, _1, _2)); + (boost::bind(&Gui::Document::slotChangedObject, this, bp::_1, bp::_2)); d->connectRenObject = pcDocument->signalRelabelObject.connect - (boost::bind(&Gui::Document::slotRelabelObject, this, _1)); + (boost::bind(&Gui::Document::slotRelabelObject, this, bp::_1)); d->connectActObject = pcDocument->signalActivatedObject.connect - (boost::bind(&Gui::Document::slotActivatedObject, this, _1)); + (boost::bind(&Gui::Document::slotActivatedObject, this, bp::_1)); d->connectActObjectBlocker = boost::signals2::shared_connection_block (d->connectActObject, false); d->connectSaveDocument = pcDocument->signalSaveDocument.connect - (boost::bind(&Gui::Document::Save, this, _1)); + (boost::bind(&Gui::Document::Save, this, bp::_1)); d->connectRestDocument = pcDocument->signalRestoreDocument.connect - (boost::bind(&Gui::Document::Restore, this, _1)); + (boost::bind(&Gui::Document::Restore, this, bp::_1)); d->connectStartLoadDocument = App::GetApplication().signalStartRestoreDocument.connect - (boost::bind(&Gui::Document::slotStartRestoreDocument, this, _1)); + (boost::bind(&Gui::Document::slotStartRestoreDocument, this, bp::_1)); d->connectFinishLoadDocument = App::GetApplication().signalFinishRestoreDocument.connect - (boost::bind(&Gui::Document::slotFinishRestoreDocument, this, _1)); + (boost::bind(&Gui::Document::slotFinishRestoreDocument, this, bp::_1)); d->connectShowHidden = App::GetApplication().signalShowHidden.connect - (boost::bind(&Gui::Document::slotShowHidden, this, _1)); + (boost::bind(&Gui::Document::slotShowHidden, this, bp::_1)); d->connectChangePropertyEditor = pcDocument->signalChangePropertyEditor.connect - (boost::bind(&Gui::Document::slotChangePropertyEditor, this, _1, _2)); + (boost::bind(&Gui::Document::slotChangePropertyEditor, this, bp::_1, bp::_2)); d->connectFinishRestoreObject = pcDocument->signalFinishRestoreObject.connect - (boost::bind(&Gui::Document::slotFinishRestoreObject, this, _1)); + (boost::bind(&Gui::Document::slotFinishRestoreObject, this, bp::_1)); d->connectExportObjects = pcDocument->signalExportViewObjects.connect - (boost::bind(&Gui::Document::exportObjects, this, _1, _2)); + (boost::bind(&Gui::Document::exportObjects, this, bp::_1, bp::_2)); d->connectImportObjects = pcDocument->signalImportViewObjects.connect - (boost::bind(&Gui::Document::importObjects, this, _1, _2, _3)); + (boost::bind(&Gui::Document::importObjects, this, bp::_1, bp::_2, bp::_3)); d->connectFinishImportObjects = pcDocument->signalFinishImportObjects.connect - (boost::bind(&Gui::Document::slotFinishImportObjects, this, _1)); + (boost::bind(&Gui::Document::slotFinishImportObjects, this, bp::_1)); d->connectUndoDocument = pcDocument->signalUndo.connect - (boost::bind(&Gui::Document::slotUndoDocument, this, _1)); + (boost::bind(&Gui::Document::slotUndoDocument, this, bp::_1)); d->connectRedoDocument = pcDocument->signalRedo.connect - (boost::bind(&Gui::Document::slotRedoDocument, this, _1)); + (boost::bind(&Gui::Document::slotRedoDocument, this, bp::_1)); d->connectRecomputed = pcDocument->signalRecomputed.connect - (boost::bind(&Gui::Document::slotRecomputed, this, _1)); + (boost::bind(&Gui::Document::slotRecomputed, this, bp::_1)); d->connectSkipRecompute = pcDocument->signalSkipRecompute.connect - (boost::bind(&Gui::Document::slotSkipRecompute, this, _1, _2)); + (boost::bind(&Gui::Document::slotSkipRecompute, this, bp::_1, bp::_2)); d->connectTouchedObject = pcDocument->signalTouchedObject.connect - (boost::bind(&Gui::Document::slotTouchedObject, this, _1)); + (boost::bind(&Gui::Document::slotTouchedObject, this, bp::_1)); d->connectTransactionAppend = pcDocument->signalTransactionAppend.connect - (boost::bind(&Gui::Document::slotTransactionAppend, this, _1, _2)); + (boost::bind(&Gui::Document::slotTransactionAppend, this, bp::_1, bp::_2)); d->connectTransactionRemove = pcDocument->signalTransactionRemove.connect - (boost::bind(&Gui::Document::slotTransactionRemove, this, _1, _2)); + (boost::bind(&Gui::Document::slotTransactionRemove, this, bp::_1, bp::_2)); // pointer to the python class // NOTE: As this Python object doesn't get returned to the interpreter we // mustn't increment it (Werner Jan-12-2006) diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index 15bd9f4120..cc8c89b247 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include #endif #include @@ -42,6 +42,7 @@ #include using namespace Gui; +namespace bp = boost::placeholders; namespace Gui { // forward declaration @@ -367,11 +368,11 @@ DocumentModel::DocumentModel(QObject* parent) } // Setup connections - Application::Instance->signalNewDocument.connect(boost::bind(&DocumentModel::slotNewDocument, this, _1)); - Application::Instance->signalDeleteDocument.connect(boost::bind(&DocumentModel::slotDeleteDocument, this, _1)); - Application::Instance->signalRenameDocument.connect(boost::bind(&DocumentModel::slotRenameDocument, this, _1)); - Application::Instance->signalActiveDocument.connect(boost::bind(&DocumentModel::slotActiveDocument, this, _1)); - Application::Instance->signalRelabelDocument.connect(boost::bind(&DocumentModel::slotRelabelDocument, this, _1)); + Application::Instance->signalNewDocument.connect(boost::bind(&DocumentModel::slotNewDocument, this, bp::_1)); + Application::Instance->signalDeleteDocument.connect(boost::bind(&DocumentModel::slotDeleteDocument, this, bp::_1)); + Application::Instance->signalRenameDocument.connect(boost::bind(&DocumentModel::slotRenameDocument, this, bp::_1)); + Application::Instance->signalActiveDocument.connect(boost::bind(&DocumentModel::slotActiveDocument, this, bp::_1)); + Application::Instance->signalRelabelDocument.connect(boost::bind(&DocumentModel::slotRelabelDocument, this, bp::_1)); } DocumentModel::~DocumentModel() @@ -381,13 +382,13 @@ DocumentModel::~DocumentModel() void DocumentModel::slotNewDocument(const Gui::Document& Doc) { - Doc.signalNewObject.connect(boost::bind(&DocumentModel::slotNewObject, this, _1)); - Doc.signalDeletedObject.connect(boost::bind(&DocumentModel::slotDeleteObject, this, _1)); - Doc.signalChangedObject.connect(boost::bind(&DocumentModel::slotChangeObject, this, _1, _2)); - Doc.signalRelabelObject.connect(boost::bind(&DocumentModel::slotRenameObject, this, _1)); - Doc.signalActivatedObject.connect(boost::bind(&DocumentModel::slotActiveObject, this, _1)); - Doc.signalInEdit.connect(boost::bind(&DocumentModel::slotInEdit, this, _1)); - Doc.signalResetEdit.connect(boost::bind(&DocumentModel::slotResetEdit, this, _1)); + Doc.signalNewObject.connect(boost::bind(&DocumentModel::slotNewObject, this, bp::_1)); + Doc.signalDeletedObject.connect(boost::bind(&DocumentModel::slotDeleteObject, this, bp::_1)); + Doc.signalChangedObject.connect(boost::bind(&DocumentModel::slotChangeObject, this, bp::_1, bp::_2)); + Doc.signalRelabelObject.connect(boost::bind(&DocumentModel::slotRenameObject, this, bp::_1)); + Doc.signalActivatedObject.connect(boost::bind(&DocumentModel::slotActiveObject, this, bp::_1)); + Doc.signalInEdit.connect(boost::bind(&DocumentModel::slotInEdit, this, bp::_1)); + Doc.signalResetEdit.connect(boost::bind(&DocumentModel::slotResetEdit, this, bp::_1)); QModelIndex parent = createIndex(0,0,d->rootItem); int count_docs = d->rootItem->childCount(); diff --git a/src/Gui/DocumentObserver.cpp b/src/Gui/DocumentObserver.cpp index 2267c5dc95..dc26658b09 100644 --- a/src/Gui/DocumentObserver.cpp +++ b/src/Gui/DocumentObserver.cpp @@ -25,10 +25,9 @@ #ifndef _PreComp_ # include +# include #endif -#include - #include "Application.h" #include "Document.h" #include "ViewProviderDocumentObject.h" @@ -36,6 +35,7 @@ #include using namespace Gui; +namespace bp = boost::placeholders; DocumentT::DocumentT() @@ -204,7 +204,7 @@ public: Private(Gui::Document* doc) : _document(doc) { if (doc) { connectApplicationDeletedDocument = doc->signalDeleteDocument.connect(boost::bind - (&Private::deletedDocument, this, _1)); + (&Private::deletedDocument, this, bp::_1)); } } @@ -255,11 +255,11 @@ public: indocument = true; Gui::Document* doc = obj->getDocument(); connectApplicationDeletedDocument = doc->signalDeleteDocument.connect(boost::bind - (&Private::deletedDocument, this, _1)); + (&Private::deletedDocument, this, bp::_1)); connectDocumentCreatedObject = doc->signalNewObject.connect(boost::bind - (&Private::createdObject, this, _1)); + (&Private::createdObject, this, bp::_1)); connectDocumentDeletedObject = doc->signalDeletedObject.connect(boost::bind - (&Private::deletedObject, this, _1)); + (&Private::deletedObject, this, bp::_1)); } } void deletedDocument(const Gui::Document& doc) { @@ -346,25 +346,25 @@ void DocumentObserver::attachDocument(Document* doc) return; this->connectDocumentCreatedObject = doc->signalNewObject.connect(boost::bind - (&DocumentObserver::slotCreatedObject, this, _1)); + (&DocumentObserver::slotCreatedObject, this, bp::_1)); this->connectDocumentDeletedObject = doc->signalDeletedObject.connect(boost::bind - (&DocumentObserver::slotDeletedObject, this, _1)); + (&DocumentObserver::slotDeletedObject, this, bp::_1)); this->connectDocumentChangedObject = doc->signalChangedObject.connect(boost::bind - (&DocumentObserver::slotChangedObject, this, _1, _2)); + (&DocumentObserver::slotChangedObject, this, bp::_1, bp::_2)); this->connectDocumentRelabelObject = doc->signalRelabelObject.connect(boost::bind - (&DocumentObserver::slotRelabelObject, this, _1)); + (&DocumentObserver::slotRelabelObject, this, bp::_1)); this->connectDocumentActivateObject = doc->signalActivatedObject.connect(boost::bind - (&DocumentObserver::slotActivatedObject, this, _1)); + (&DocumentObserver::slotActivatedObject, this, bp::_1)); this->connectDocumentEditObject = doc->signalInEdit.connect(boost::bind - (&DocumentObserver::slotEnterEditObject, this, _1)); + (&DocumentObserver::slotEnterEditObject, this, bp::_1)); this->connectDocumentResetObject = doc->signalResetEdit.connect(boost::bind - (&DocumentObserver::slotResetEditObject, this, _1)); + (&DocumentObserver::slotResetEditObject, this, bp::_1)); this->connectDocumentUndo = doc->signalUndoDocument.connect(boost::bind - (&DocumentObserver::slotUndoDocument, this, _1)); + (&DocumentObserver::slotUndoDocument, this, bp::_1)); this->connectDocumentRedo = doc->signalRedoDocument.connect(boost::bind - (&DocumentObserver::slotRedoDocument, this, _1)); + (&DocumentObserver::slotRedoDocument, this, bp::_1)); this->connectDocumentDelete = doc->signalDeleteDocument.connect(boost::bind - (&DocumentObserver::slotDeleteDocument, this, _1)); + (&DocumentObserver::slotDeleteDocument, this, bp::_1)); } void DocumentObserver::detachDocument() diff --git a/src/Gui/DocumentObserverPython.cpp b/src/Gui/DocumentObserverPython.cpp index ab59d9882e..913e0deb1d 100644 --- a/src/Gui/DocumentObserverPython.cpp +++ b/src/Gui/DocumentObserverPython.cpp @@ -35,6 +35,7 @@ #include using namespace Gui; +namespace bp = boost::placeholders; std::vector DocumentObserverPython::_instances; @@ -64,7 +65,7 @@ DocumentObserverPython::DocumentObserverPython(const Py::Object& obj) : inst(obj FC_PY_GetCallable(obj.ptr(), "slot" #_name1, py##_name1.py);\ if (!py##_name1.py.isNone())\ py##_name1.slot = Application::Instance->signal##_name2.connect(\ - boost::bind(&DocumentObserverPython::slot##_name1, this, _1));\ + boost::bind(&DocumentObserverPython::slot##_name1, this, bp::_1));\ }\ while(0); @@ -72,7 +73,7 @@ DocumentObserverPython::DocumentObserverPython(const Py::Object& obj) : inst(obj FC_PY_GetCallable(obj.ptr(), "slot" #_name1, py##_name1.py);\ if (!py##_name1.py.isNone())\ py##_name1.slot = Application::Instance->signal##_name2.connect(\ - boost::bind(&DocumentObserverPython::slot##_name1, this, _1, _2));\ + boost::bind(&DocumentObserverPython::slot##_name1, this, bp::_1, bp::_2));\ }\ while(0); diff --git a/src/Gui/DocumentObserverPython.h b/src/Gui/DocumentObserverPython.h index 0f18696fc4..bd3aa5b51d 100644 --- a/src/Gui/DocumentObserverPython.h +++ b/src/Gui/DocumentObserverPython.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace Gui { diff --git a/src/Gui/ExpressionBinding.cpp b/src/Gui/ExpressionBinding.cpp index be47e2b77e..c96e9b4463 100644 --- a/src/Gui/ExpressionBinding.cpp +++ b/src/Gui/ExpressionBinding.cpp @@ -34,12 +34,13 @@ #include #include #include -#include +#include FC_LOG_LEVEL_INIT("Expression",true,true) using namespace Gui; using namespace App; +namespace bp = boost::placeholders; ExpressionBinding::ExpressionBinding() : iconLabel(0) @@ -99,7 +100,7 @@ void ExpressionBinding::bind(const App::ObjectIdentifier &_path) //connect to be informed about changes DocumentObject * docObj = path.getDocumentObject(); - connection = docObj->ExpressionEngine.expressionChanged.connect(boost::bind(&ExpressionBinding::expressionChange, this, _1)); + connection = docObj->ExpressionEngine.expressionChanged.connect(boost::bind(&ExpressionBinding::expressionChange, this, bp::_1)); } void ExpressionBinding::bind(const Property &prop) diff --git a/src/Gui/GraphvizView.cpp b/src/Gui/GraphvizView.cpp index afffc62449..62e69ef852 100644 --- a/src/Gui/GraphvizView.cpp +++ b/src/Gui/GraphvizView.cpp @@ -37,7 +37,7 @@ # include # include # include -# include +# include #endif #include "GraphicsViewZoom.h" #include "FileDialog.h" @@ -50,6 +50,7 @@ #include using namespace Gui; +namespace bp = boost::placeholders; namespace Gui { @@ -187,9 +188,9 @@ GraphvizView::GraphvizView(App::Document & _doc, QWidget* parent) connect(thread, SIGNAL(svgFileRead(const QByteArray &)), this, SLOT(svgFileRead(const QByteArray &))); // Connect signal from document - recomputeConnection = _doc.signalRecomputed.connect(boost::bind(&GraphvizView::updateSvgItem, this, _1)); - undoConnection = _doc.signalUndo.connect(boost::bind(&GraphvizView::updateSvgItem, this, _1)); - redoConnection = _doc.signalRedo.connect(boost::bind(&GraphvizView::updateSvgItem, this, _1)); + recomputeConnection = _doc.signalRecomputed.connect(boost::bind(&GraphvizView::updateSvgItem, this, bp::_1)); + undoConnection = _doc.signalUndo.connect(boost::bind(&GraphvizView::updateSvgItem, this, bp::_1)); + redoConnection = _doc.signalRedo.connect(boost::bind(&GraphvizView::updateSvgItem, this, bp::_1)); updateSvgItem(_doc); } diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index a010b95da7..60b7b43b13 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include # include # include # include @@ -44,6 +44,7 @@ #include "ViewProviderDocumentObject.h" using namespace Gui; +namespace bp = boost::placeholders; TYPESYSTEM_SOURCE_ABSTRACT(Gui::MDIView,Gui::BaseView) @@ -61,7 +62,7 @@ MDIView::MDIView(Gui::Document* pcDocument,QWidget* parent, Qt::WindowFlags wfla if (pcDocument) { connectDelObject = pcDocument->signalDeletedObject.connect - (boost::bind(&ActiveObjectList::objectDeleted, &ActiveObjects, _1)); + (boost::bind(&ActiveObjectList::objectDeleted, &ActiveObjects, bp::_1)); assert(connectDelObject.connected()); } } diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 3812d552f4..bf89926d0b 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -53,8 +53,6 @@ # include #endif -#include - // FreeCAD Base header #include #include diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index ccb0f2d8c2..2deb44e8c3 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -47,9 +47,9 @@ # include # include # include +# include #endif -#include #include #include @@ -70,6 +70,7 @@ using namespace Gui; +namespace bp = boost::placeholders; AlignmentGroup::AlignmentGroup() { @@ -668,7 +669,7 @@ ManualAlignment::ManualAlignment() { // connect with the application's signal for deletion of documents this->connectApplicationDeletedDocument = Gui::Application::Instance->signalDeleteDocument - .connect(boost::bind(&ManualAlignment::slotDeletedDocument, this, _1)); + .connect(boost::bind(&ManualAlignment::slotDeletedDocument, this, bp::_1)); // setup sensor connection d->sensorCam1 = new SoNodeSensor(Private::syncCameraCB, this); @@ -862,7 +863,7 @@ void ManualAlignment::startAlignment(Base::Type mousemodel) if (this->connectDocumentDeletedObject.connected()) this->connectDocumentDeletedObject.disconnect(); this->connectDocumentDeletedObject = myDocument->signalDeletedObject.connect(boost::bind - (&ManualAlignment::slotDeletedObject, this, _1)); + (&ManualAlignment::slotDeletedObject, this, bp::_1)); continueAlignment(); } diff --git a/src/Gui/MergeDocuments.cpp b/src/Gui/MergeDocuments.cpp index a32687b604..e79a171bdb 100644 --- a/src/Gui/MergeDocuments.cpp +++ b/src/Gui/MergeDocuments.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include #endif #include "MergeDocuments.h" #include @@ -36,6 +36,7 @@ #include using namespace Gui; +namespace bp = boost::placeholders; namespace Gui { @@ -122,9 +123,9 @@ private: MergeDocuments::MergeDocuments(App::Document* doc) : stream(0), appdoc(doc) { connectExport = doc->signalExportObjects.connect - (boost::bind(&MergeDocuments::exportObject, this, _1, _2)); + (boost::bind(&MergeDocuments::exportObject, this, bp::_1, bp::_2)); connectImport = doc->signalImportObjects.connect - (boost::bind(&MergeDocuments::importObject, this, _1, _2)); + (boost::bind(&MergeDocuments::importObject, this, bp::_1, bp::_2)); document = Gui::Application::Instance->getDocument(doc); } diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 6880ff9249..27af9afc0a 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -22,11 +22,14 @@ #include "PreCompiled.h" +#ifndef _PreComp_ #include #include #include #include #include +#include +#endif #include "Placement.h" #include "ui_Placement.h" @@ -45,6 +48,7 @@ #include using namespace Gui::Dialog; +namespace bp = boost::placeholders; namespace Gui { namespace Dialog { class find_placement @@ -118,7 +122,7 @@ Placement::Placement(QWidget* parent, Qt::WindowFlags fl) connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(onPlacementChanged(int))); connectAct = Application::Instance->signalActiveDocument.connect - (boost::bind(&Placement::slotActiveDocument, this, _1)); + (boost::bind(&Placement::slotActiveDocument, this, bp::_1)); App::Document* activeDoc = App::GetApplication().getActiveDocument(); if (activeDoc) documents.insert(activeDoc->getName()); diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index 87be33bb88..fb5a6b0075 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -30,7 +30,6 @@ #include #include -#include class QSignalMapper; diff --git a/src/Gui/PreCompiled.h b/src/Gui/PreCompiled.h index c6d67c0c47..b759199162 100644 --- a/src/Gui/PreCompiled.h +++ b/src/Gui/PreCompiled.h @@ -78,7 +78,7 @@ // Boost #include -#include +#include #include #include #include diff --git a/src/Gui/ProjectView.cpp b/src/Gui/ProjectView.cpp index 316d0acf71..857cf24f59 100644 --- a/src/Gui/ProjectView.cpp +++ b/src/Gui/ProjectView.cpp @@ -24,7 +24,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include # include # include # include diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index ac338f12ae..6a5804747b 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -27,9 +27,9 @@ # include # include # include +# include #endif -#include /// Here the FreeCAD includes sorted by Base,App,Gui...... #include @@ -57,6 +57,7 @@ using namespace std; using namespace Gui; using namespace Gui::DockWnd; using namespace Gui::PropertyEditor; +namespace bp = boost::placeholders; static ParameterGrp::handle _GetParam() { static ParameterGrp::handle hGrp; @@ -111,19 +112,19 @@ PropertyView::PropertyView(QWidget *parent) this->connectPropData = App::GetApplication().signalChangedObject.connect(boost::bind - (&PropertyView::slotChangePropertyData, this, _1, _2)); + (&PropertyView::slotChangePropertyData, this, bp::_1, bp::_2)); this->connectPropView = Gui::Application::Instance->signalChangedObject.connect(boost::bind - (&PropertyView::slotChangePropertyView, this, _1, _2)); + (&PropertyView::slotChangePropertyView, this, bp::_1, bp::_2)); this->connectPropAppend = App::GetApplication().signalAppendDynamicProperty.connect(boost::bind - (&PropertyView::slotAppendDynamicProperty, this, _1)); + (&PropertyView::slotAppendDynamicProperty, this, bp::_1)); this->connectPropRemove = App::GetApplication().signalRemoveDynamicProperty.connect(boost::bind - (&PropertyView::slotRemoveDynamicProperty, this, _1)); + (&PropertyView::slotRemoveDynamicProperty, this, bp::_1)); this->connectPropChange = App::GetApplication().signalChangePropertyEditor.connect(boost::bind - (&PropertyView::slotChangePropertyEditor, this, _1, _2)); + (&PropertyView::slotChangePropertyEditor, this, bp::_1, bp::_2)); this->connectUndoDocument = App::GetApplication().signalUndoDocument.connect(boost::bind (&PropertyView::slotRollback, this)); @@ -132,16 +133,16 @@ PropertyView::PropertyView(QWidget *parent) (&PropertyView::slotRollback, this)); this->connectActiveDoc = Application::Instance->signalActiveDocument.connect(boost::bind - (&PropertyView::slotActiveDocument, this, _1)); + (&PropertyView::slotActiveDocument, this, bp::_1)); this->connectDelDocument = Application::Instance->signalDeleteDocument.connect( - boost::bind(&PropertyView::slotDeleteDocument, this, _1)); + boost::bind(&PropertyView::slotDeleteDocument, this, bp::_1)); this->connectDelViewObject = Application::Instance->signalDeletedObject.connect( - boost::bind(&PropertyView::slotDeletedViewObject, this, _1)); + boost::bind(&PropertyView::slotDeletedViewObject, this, bp::_1)); this->connectDelObject = App::GetApplication().signalDeletedObject.connect( - boost::bind(&PropertyView::slotDeletedObject, this, _1)); + boost::bind(&PropertyView::slotDeletedObject, this, bp::_1)); } PropertyView::~PropertyView() diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index 752ff07667..df7e42f2a8 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -26,7 +26,7 @@ #ifndef _PreComp_ # include # include -# include +# include # include # include # include @@ -60,6 +60,7 @@ FC_LOG_LEVEL_INIT("Selection",false,true,true) using namespace Gui; using namespace std; +namespace bp = boost::placeholders; SelectionGateFilterExternal::SelectionGateFilterExternal(const char *docName, const char *objName) { if(docName) { @@ -134,7 +135,7 @@ void SelectionObserver::attachSelection() resolve?Selection().signalSelectionChanged2: Selection().signalSelectionChanged); connectSelection = signal.connect(boost::bind - (&SelectionObserver::_onSelectionChanged, this, _1)); + (&SelectionObserver::_onSelectionChanged, this, bp::_1)); if(filterDocName.size()) Selection().addSelectionGate( new SelectionGateFilterExternal(filterDocName.c_str(),filterObjName.c_str())); @@ -1761,8 +1762,8 @@ SelectionSingleton::SelectionSingleton() hz = 0; ActiveGate = 0; gateResolve = 1; - App::GetApplication().signalDeletedObject.connect(boost::bind(&Gui::SelectionSingleton::slotDeletedObject, this, _1)); - signalSelectionChanged.connect(boost::bind(&Gui::SelectionSingleton::slotSelectionChanged, this, _1)); + App::GetApplication().signalDeletedObject.connect(boost::bind(&Gui::SelectionSingleton::slotDeletedObject, this, bp::_1)); + signalSelectionChanged.connect(boost::bind(&Gui::SelectionSingleton::slotSelectionChanged, this, bp::_1)); } /** diff --git a/src/Gui/TaskElementColors.cpp b/src/Gui/TaskElementColors.cpp index b61b60724b..0beb88c469 100644 --- a/src/Gui/TaskElementColors.cpp +++ b/src/Gui/TaskElementColors.cpp @@ -28,7 +28,7 @@ #include -#include +#include #include #include "ui_TaskElementColors.h" @@ -52,6 +52,7 @@ FC_LOG_LEVEL_INIT("Gui",true,true) using namespace Gui; +namespace bp = boost::placeholders; class ElementColors::Private: public Gui::SelectionGate { @@ -323,9 +324,9 @@ ElementColors::ElementColors(ViewProviderDocumentObject* vp, bool noHide) Selection().addSelectionGate(d,0); d->connectDelDoc = Application::Instance->signalDeleteDocument.connect(boost::bind - (&ElementColors::slotDeleteDocument, this, _1)); + (&ElementColors::slotDeleteDocument, this, bp::_1)); d->connectDelObj = Application::Instance->signalDeletedObject.connect(boost::bind - (&ElementColors::slotDeleteObject, this, _1)); + (&ElementColors::slotDeleteObject, this, bp::_1)); d->populate(); } diff --git a/src/Gui/TaskView/TaskAppearance.cpp b/src/Gui/TaskView/TaskAppearance.cpp index 976f707132..450df1f566 100644 --- a/src/Gui/TaskView/TaskAppearance.cpp +++ b/src/Gui/TaskView/TaskAppearance.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include #endif #include "ui_TaskAppearance.h" @@ -38,6 +38,7 @@ #include using namespace Gui::TaskView; +namespace bp = boost::placeholders; /* TRANSLATOR Gui::TaskView::TaskAppearance */ @@ -57,7 +58,7 @@ TaskAppearance::TaskAppearance(QWidget *parent) this->connectChangedObject = Gui::Application::Instance->signalChangedObject.connect(boost::bind - (&TaskAppearance::slotChangedObject, this, _1, _2)); + (&TaskAppearance::slotChangedObject, this, bp::_1, bp::_2)); } TaskAppearance::~TaskAppearance() diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.cpp b/src/Gui/TaskView/TaskSelectLinkProperty.cpp index 62722df247..8d2faae0e3 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.cpp +++ b/src/Gui/TaskView/TaskSelectLinkProperty.cpp @@ -25,7 +25,6 @@ #ifndef _PreComp_ # include -# include #endif #include "ui_TaskSelectLinkProperty.h" diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 8d9904bdf4..fd500d4c94 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include # include # include @@ -53,6 +53,7 @@ #endif using namespace Gui::TaskView; +namespace bp = boost::placeholders; //************************************************************************** //************************************************************************** @@ -398,16 +399,16 @@ TaskView::TaskView(QWidget *parent) connectApplicationActiveDocument = App::GetApplication().signalActiveDocument.connect - (boost::bind(&Gui::TaskView::TaskView::slotActiveDocument, this, _1)); + (boost::bind(&Gui::TaskView::TaskView::slotActiveDocument, this, bp::_1)); connectApplicationDeleteDocument = App::GetApplication().signalDeletedDocument.connect (boost::bind(&Gui::TaskView::TaskView::slotDeletedDocument, this)); connectApplicationUndoDocument = App::GetApplication().signalUndoDocument.connect - (boost::bind(&Gui::TaskView::TaskView::slotUndoDocument, this, _1)); + (boost::bind(&Gui::TaskView::TaskView::slotUndoDocument, this, bp::_1)); connectApplicationRedoDocument = App::GetApplication().signalRedoDocument.connect - (boost::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, _1)); + (boost::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, bp::_1)); } TaskView::~TaskView() diff --git a/src/Gui/TextDocumentEditorView.cpp b/src/Gui/TextDocumentEditorView.cpp index 43fbb2980d..63d9b7d76c 100644 --- a/src/Gui/TextDocumentEditorView.cpp +++ b/src/Gui/TextDocumentEditorView.cpp @@ -30,11 +30,11 @@ # include # include # include +# include +# include +# include #endif -#include -#include -#include #include #include diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index f82b597f38..88e2c8b672 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include # include # include @@ -78,6 +78,7 @@ FC_LOG_LEVEL_INIT("Tree",false,true,true) #define TREE_TRACE(_msg) _TREE_PRINT(FC_LOGLEVEL_TRACE,NotifyLog,_msg) using namespace Gui; +namespace bp = boost::placeholders; ///////////////////////////////////////////////////////////////////////////////// @@ -262,9 +263,9 @@ public: connectIcon = viewObject->signalChangeIcon.connect( boost::bind(&DocumentObjectData::slotChangeIcon, this)); connectTool = viewObject->signalChangeToolTip.connect( - boost::bind(&DocumentObjectData::slotChangeToolTip, this, _1)); + boost::bind(&DocumentObjectData::slotChangeToolTip, this, bp::_1)); connectStat = viewObject->signalChangeStatusTip.connect( - boost::bind(&DocumentObjectData::slotChangeStatusTip, this, _1)); + boost::bind(&DocumentObjectData::slotChangeStatusTip, this, bp::_1)); removeChildrenFromRoot = viewObject->canRemoveChildrenFromRoot(); itemHidden = !viewObject->showInTree(); @@ -487,18 +488,18 @@ TreeWidget::TreeWidget(const char *name, QWidget* parent) this, SLOT(onSearchObjects())); // Setup connections - connectNewDocument = Application::Instance->signalNewDocument.connect(boost::bind(&TreeWidget::slotNewDocument, this, _1, _2)); - connectDelDocument = Application::Instance->signalDeleteDocument.connect(boost::bind(&TreeWidget::slotDeleteDocument, this, _1)); - connectRenDocument = Application::Instance->signalRenameDocument.connect(boost::bind(&TreeWidget::slotRenameDocument, this, _1)); - connectActDocument = Application::Instance->signalActiveDocument.connect(boost::bind(&TreeWidget::slotActiveDocument, this, _1)); - connectRelDocument = Application::Instance->signalRelabelDocument.connect(boost::bind(&TreeWidget::slotRelabelDocument, this, _1)); - connectShowHidden = Application::Instance->signalShowHidden.connect(boost::bind(&TreeWidget::slotShowHidden, this, _1)); + connectNewDocument = Application::Instance->signalNewDocument.connect(boost::bind(&TreeWidget::slotNewDocument, this, bp::_1, bp::_2)); + connectDelDocument = Application::Instance->signalDeleteDocument.connect(boost::bind(&TreeWidget::slotDeleteDocument, this, bp::_1)); + connectRenDocument = Application::Instance->signalRenameDocument.connect(boost::bind(&TreeWidget::slotRenameDocument, this, bp::_1)); + connectActDocument = Application::Instance->signalActiveDocument.connect(boost::bind(&TreeWidget::slotActiveDocument, this, bp::_1)); + connectRelDocument = Application::Instance->signalRelabelDocument.connect(boost::bind(&TreeWidget::slotRelabelDocument, this, bp::_1)); + connectShowHidden = Application::Instance->signalShowHidden.connect(boost::bind(&TreeWidget::slotShowHidden, this, bp::_1)); // Gui::Document::signalChangedObject informs the App::Document property // change, not view provider's own property, which is what the signal below // for connectChangedViewObj = Application::Instance->signalChangedObject.connect( - boost::bind(&TreeWidget::slotChangedViewObject, this, _1,_2)); + boost::bind(&TreeWidget::slotChangedViewObject, this, bp::_1, bp::_2)); // make sure to show a horizontal scrollbar if needed #if QT_VERSION >= 0x050000 @@ -2393,9 +2394,9 @@ void TreeWidget::onUpdateStatus(void) if(!docItem->connectChgObject.connected()) { docItem->connectChgObject = docItem->document()->signalChangedObject.connect( - boost::bind(&TreeWidget::slotChangeObject, this, _1, _2)); + boost::bind(&TreeWidget::slotChangeObject, this, bp::_1, bp::_2)); docItem->connectTouchedObject = doc->signalTouchedObject.connect( - boost::bind(&TreeWidget::slotTouchedObject, this, _1)); + boost::bind(&TreeWidget::slotTouchedObject, this, bp::_1)); } if(doc->testStatus(App::Document::PartialDoc)) @@ -2973,26 +2974,26 @@ DocumentItem::DocumentItem(const Gui::Document* doc, QTreeWidgetItem * parent) : QTreeWidgetItem(parent, TreeWidget::DocumentType), pDocument(const_cast(doc)) { // Setup connections - connectNewObject = doc->signalNewObject.connect(boost::bind(&DocumentItem::slotNewObject, this, _1)); + connectNewObject = doc->signalNewObject.connect(boost::bind(&DocumentItem::slotNewObject, this, bp::_1)); connectDelObject = doc->signalDeletedObject.connect( - boost::bind(&TreeWidget::slotDeleteObject, getTree(), _1)); + boost::bind(&TreeWidget::slotDeleteObject, getTree(), bp::_1)); if(!App::GetApplication().isRestoring()) { connectChgObject = doc->signalChangedObject.connect( - boost::bind(&TreeWidget::slotChangeObject, getTree(), _1, _2)); + boost::bind(&TreeWidget::slotChangeObject, getTree(), bp::_1, bp::_2)); connectTouchedObject = doc->getDocument()->signalTouchedObject.connect( - boost::bind(&TreeWidget::slotTouchedObject, getTree(), _1)); + boost::bind(&TreeWidget::slotTouchedObject, getTree(), bp::_1)); } - connectEdtObject = doc->signalInEdit.connect(boost::bind(&DocumentItem::slotInEdit, this, _1)); - connectResObject = doc->signalResetEdit.connect(boost::bind(&DocumentItem::slotResetEdit, this, _1)); + connectEdtObject = doc->signalInEdit.connect(boost::bind(&DocumentItem::slotInEdit, this, bp::_1)); + connectResObject = doc->signalResetEdit.connect(boost::bind(&DocumentItem::slotResetEdit, this, bp::_1)); connectHltObject = doc->signalHighlightObject.connect( - boost::bind(&DocumentItem::slotHighlightObject, this, _1,_2,_3,_4,_5)); + boost::bind(&DocumentItem::slotHighlightObject, this, bp::_1, bp::_2, bp::_3, bp::_4, bp::_5)); connectExpObject = doc->signalExpandObject.connect( - boost::bind(&DocumentItem::slotExpandObject, this, _1,_2,_3,_4)); - connectScrObject = doc->signalScrollToObject.connect(boost::bind(&DocumentItem::slotScrollToObject, this, _1)); + boost::bind(&DocumentItem::slotExpandObject, this, bp::_1, bp::_2, bp::_3, bp::_4)); + connectScrObject = doc->signalScrollToObject.connect(boost::bind(&DocumentItem::slotScrollToObject, this, bp::_1)); auto adoc = doc->getDocument(); - connectRecomputed = adoc->signalRecomputed.connect(boost::bind(&DocumentItem::slotRecomputed, this, _1, _2)); + connectRecomputed = adoc->signalRecomputed.connect(boost::bind(&DocumentItem::slotRecomputed, this, bp::_1, bp::_2)); connectRecomputedObj = adoc->signalRecomputedObject.connect( - boost::bind(&DocumentItem::slotRecomputedObject, this, _1)); + boost::bind(&DocumentItem::slotRecomputedObject, this, bp::_1)); setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable/*|Qt::ItemIsEditable*/); diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 76a1927eda..cb0a039685 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -38,6 +38,7 @@ # include # include # include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... @@ -61,7 +62,6 @@ #include "ViewProviderLink.h" #include "ViewParams.h" -#include FC_LOG_LEVEL_INIT("ViewProvider",true,true) diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 1ae75cb20f..e5f437ff51 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Gui/ViewProviderOrigin.cpp b/src/Gui/ViewProviderOrigin.cpp index 8800e7432f..37ea28864e 100644 --- a/src/Gui/ViewProviderOrigin.cpp +++ b/src/Gui/ViewProviderOrigin.cpp @@ -29,7 +29,6 @@ # include # include # include -# include #endif diff --git a/src/Gui/ViewProviderOriginGroup.cpp b/src/Gui/ViewProviderOriginGroup.cpp index 3825cb0a8f..bb8a959698 100644 --- a/src/Gui/ViewProviderOriginGroup.cpp +++ b/src/Gui/ViewProviderOriginGroup.cpp @@ -23,9 +23,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include -# include -# include #endif #include diff --git a/src/Gui/ViewProviderOriginGroupExtension.cpp b/src/Gui/ViewProviderOriginGroupExtension.cpp index 450360fddc..9955fca052 100644 --- a/src/Gui/ViewProviderOriginGroupExtension.cpp +++ b/src/Gui/ViewProviderOriginGroupExtension.cpp @@ -25,6 +25,9 @@ #include "PreCompiled.h" #ifndef _PreComp_ +#include +#include +#include #endif #include "ViewProviderOriginGroupExtension.h" @@ -39,11 +42,10 @@ #include #include #include -#include -#include -#include using namespace Gui; +namespace bp = boost::placeholders; + EXTENSION_PROPERTY_SOURCE(Gui::ViewProviderOriginGroupExtension, Gui::ViewProviderGeoFeatureGroupExtension) @@ -97,10 +99,10 @@ void ViewProviderOriginGroupExtension::extensionAttach(App::DocumentObject *pcOb assert ( gdoc ); connectChangedObjectApp = adoc->signalChangedObject.connect ( - boost::bind ( &ViewProviderOriginGroupExtension::slotChangedObjectApp, this, _1) ); + boost::bind ( &ViewProviderOriginGroupExtension::slotChangedObjectApp, this, bp::_1) ); connectChangedObjectGui = gdoc->signalChangedObject.connect ( - boost::bind ( &ViewProviderOriginGroupExtension::slotChangedObjectGui, this, _1) ); + boost::bind ( &ViewProviderOriginGroupExtension::slotChangedObjectGui, this, bp::_1) ); } void ViewProviderOriginGroupExtension::extensionUpdateData( const App::Property* prop ) { diff --git a/src/Gui/ViewProviderPart.cpp b/src/Gui/ViewProviderPart.cpp index eab01ae21c..2790e8b460 100644 --- a/src/Gui/ViewProviderPart.cpp +++ b/src/Gui/ViewProviderPart.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include #endif #include diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index c5ea875ddc..4e1cbca261 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -30,7 +30,7 @@ # include # include # include -# include +# include # include # include # include @@ -71,6 +71,7 @@ FC_LOG_LEVEL_INIT("ViewProviderPythonFeature",true,true) using namespace Gui; +namespace bp = boost::placeholders; // #0003564: Python objects: updateData calls to proxy instance that should have been deleted // See https://forum.freecadweb.org/viewtopic.php?f=22&t=30429&p=252429#p252429 @@ -274,11 +275,11 @@ void ViewProviderPythonFeatureObserver::slotDeleteObject(const Gui::ViewProvider ViewProviderPythonFeatureObserver::ViewProviderPythonFeatureObserver() { Gui::Application::Instance->signalDeletedObject.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotDeleteObject, this, _1)); + (&ViewProviderPythonFeatureObserver::slotDeleteObject, this, bp::_1)); Gui::Application::Instance->signalNewObject.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotAppendObject, this, _1)); + (&ViewProviderPythonFeatureObserver::slotAppendObject, this, bp::_1)); Gui::Application::Instance->signalDeleteDocument.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotDeleteDocument, this, _1)); + (&ViewProviderPythonFeatureObserver::slotDeleteDocument, this, bp::_1)); } ViewProviderPythonFeatureObserver::~ViewProviderPythonFeatureObserver() diff --git a/src/Gui/ViewProviderTextDocument.cpp b/src/Gui/ViewProviderTextDocument.cpp index 989f82882c..db592a5372 100644 --- a/src/Gui/ViewProviderTextDocument.cpp +++ b/src/Gui/ViewProviderTextDocument.cpp @@ -26,7 +26,7 @@ #ifndef _PreComp_ # include # include -# include +# include #endif #include diff --git a/src/Mod/Assembly/App/opendcm/core/imp/clustergraph_imp.hpp b/src/Mod/Assembly/App/opendcm/core/imp/clustergraph_imp.hpp index 6cf0e0b369..a785a39a63 100644 --- a/src/Mod/Assembly/App/opendcm/core/imp/clustergraph_imp.hpp +++ b/src/Mod/Assembly/App/opendcm/core/imp/clustergraph_imp.hpp @@ -27,7 +27,9 @@ #include #include -#include +#include + +namespace bp = boost::placeholders; namespace dcm { @@ -686,7 +688,7 @@ void ClusterGraph::downstreamRemo re.push_back(* (it.first)); }; - std::for_each(re.begin(), re.end(), boost::bind(&ClusterGraph::simpleRemoveEdge, this, _1)); + std::for_each(re.begin(), re.end(), boost::bind(&ClusterGraph::simpleRemoveEdge, this, bp::_1)); //if we have the real vertex here and not only a containing cluster we can delete it if(!isCluster(res.first)) { @@ -751,7 +753,7 @@ template void ClusterGraph::removeEdge(LocalEdge id, Functor& f) { std::vector& vec = fusion::at_c<1> ((*this) [id]); - std::for_each(vec.begin(), vec.end(), boost::bind (boost::ref(apply_remove_prediacte (f, -1)), _1)); + std::for_each(vec.begin(), vec.end(), boost::bind (boost::ref(apply_remove_prediacte (f, -1)), bp::_1)); boost::remove_edge(id, *this); }; diff --git a/src/Mod/Assembly/App/opendcm/module3d/imp/module_imp.hpp b/src/Mod/Assembly/App/opendcm/module3d/imp/module_imp.hpp index 983b3ab090..ac93f0a884 100644 --- a/src/Mod/Assembly/App/opendcm/module3d/imp/module_imp.hpp +++ b/src/Mod/Assembly/App/opendcm/module3d/imp/module_imp.hpp @@ -22,10 +22,11 @@ #include "../module.hpp" -#include +#include #include "constraint3d_imp.hpp" #include "geometry3d_imp.hpp" +namespace bp = boost::placeholders; namespace dcm { @@ -112,7 +113,7 @@ void Module3D::type::inheriter_base::removeGeometry3D(Geom g) g->template emitSignal(g); //remove the vertex from graph and emit all edges that get removed with the functor - boost::function functor = boost::bind(&inheriter_base::apply_edge_remove, this, _1); + boost::function functor = boost::bind(&inheriter_base::apply_edge_remove, this, bp::_1); m_this->m_cluster->removeVertex(v, functor); m_this->erase(g); }; diff --git a/src/Mod/Assembly/App/opendcm/moduleShape3d/generator.hpp b/src/Mod/Assembly/App/opendcm/moduleShape3d/generator.hpp index 38eb3b8d31..100bce8f89 100644 --- a/src/Mod/Assembly/App/opendcm/moduleShape3d/generator.hpp +++ b/src/Mod/Assembly/App/opendcm/moduleShape3d/generator.hpp @@ -28,7 +28,8 @@ #include "defines.hpp" #include -#include +#include +namespace bp = boost::placeholders; namespace dcm { @@ -159,7 +160,7 @@ struct segment3D { base::append(g1); g1->template linkTo(base::m_shape,0); g1->template setProperty(line); - g1->template connectSignal(boost::bind(&base::Shape3D::recalc, base::m_shape, _1)); + g1->template connectSignal(boost::bind(&base::Shape3D::recalc, base::m_shape, bp::_1)); //we have a segment, lets link the two points to it boost::shared_ptr g2 = base::m_system->createGeometry3D(); @@ -205,7 +206,7 @@ struct segment3D { base::append(g3); g3->template linkTo(base::m_shape,0); g3->template setProperty(line); - g3->template connectSignal(boost::bind(&base::Shape3D::recalc, base::m_shape, _1)); + g3->template connectSignal(boost::bind(&base::Shape3D::recalc, base::m_shape, bp::_1)); //link the points to our new segment g1->template linkTo(base::m_shape, 0); diff --git a/src/Mod/Assembly/Gui/TaskAssemblyConstraints.cpp b/src/Mod/Assembly/Gui/TaskAssemblyConstraints.cpp index 38f575c947..41648451c0 100644 --- a/src/Mod/Assembly/Gui/TaskAssemblyConstraints.cpp +++ b/src/Mod/Assembly/Gui/TaskAssemblyConstraints.cpp @@ -42,7 +42,6 @@ #include #include #include -#include using namespace AssemblyGui; using namespace Gui::TaskView; diff --git a/src/Mod/Assembly/Gui/Workbench.cpp b/src/Mod/Assembly/Gui/Workbench.cpp index b93dc6f6d4..c751ae1ebe 100644 --- a/src/Mod/Assembly/Gui/Workbench.cpp +++ b/src/Mod/Assembly/Gui/Workbench.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include #endif @@ -39,7 +39,7 @@ #include "Workbench.h" using namespace AssemblyGui; - +namespace bp = boost::placeholders; @@ -202,10 +202,10 @@ void Workbench::activated() //} // Let us be notified when a document is activated, so that we can update the ActivePartObject - Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, _1)); - App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, _1)); - App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, _1)); - App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, _1)); + Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); + App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); + App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); + App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); Gui::Control().showModelView(); @@ -216,10 +216,10 @@ void Workbench::deactivated() Gui::Command::doCommand(Gui::Command::Doc,"AssemblyGui.setActiveAssembly(None)"); // Disconnect all document signals... - Gui::Application::Instance->signalActiveDocument.disconnect(boost::bind(&Workbench::slotActiveDocument, this, _1)); - App::GetApplication().signalNewDocument.disconnect(boost::bind(&Workbench::slotNewDocument, this, _1)); - App::GetApplication().signalFinishRestoreDocument.disconnect(boost::bind(&Workbench::slotFinishRestoreDocument, this, _1)); - App::GetApplication().signalDeleteDocument.disconnect(boost::bind(&Workbench::slotDeleteDocument, this, _1)); + Gui::Application::Instance->signalActiveDocument.disconnect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); + App::GetApplication().signalNewDocument.disconnect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); + App::GetApplication().signalFinishRestoreDocument.disconnect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); + App::GetApplication().signalDeleteDocument.disconnect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); Gui::Workbench::deactivated(); removeTaskWatcher(); diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp index 3b5776c0a7..9859f16ab9 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp @@ -37,12 +37,13 @@ #include #include -#include +#include using namespace Gui; using namespace DrawingGui; using namespace std; +namespace bp = boost::placeholders; #ifndef PI @@ -304,9 +305,9 @@ OrthoViews::OrthoViews(App::Document* doc, const char * pagename, const char * p num_gaps_x = num_gaps_y = 0; this->connectDocumentDeletedObject = doc->signalDeletedObject.connect(boost::bind - (&OrthoViews::slotDeletedObject, this, _1)); + (&OrthoViews::slotDeletedObject, this, bp::_1)); this->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind - (&OrthoViews::slotDeletedDocument, this, _1)); + (&OrthoViews::slotDeletedDocument, this, bp::_1)); } OrthoViews::~OrthoViews() diff --git a/src/Mod/Fem/Gui/PreCompiled.h b/src/Mod/Fem/Gui/PreCompiled.h index 077b4b357d..c683bfb3e7 100644 --- a/src/Mod/Fem/Gui/PreCompiled.h +++ b/src/Mod/Fem/Gui/PreCompiled.h @@ -69,7 +69,7 @@ #include // boost -#include +#include #include #ifdef FC_OS_WIN32 diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp index d51b707750..cacaf49a55 100644 --- a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include # include # include #endif diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp index 7bded0611b..d507a22ca7 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp @@ -47,7 +47,7 @@ # include -# include +# include # include #endif @@ -69,12 +69,13 @@ #include "ui_SphereWidget.h" using namespace FemGui; +namespace bp = boost::placeholders; void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) { m_view = view; m_object = static_cast(view->getObject()); - m_connection = m_object->getDocument()->signalChangedObject.connect(boost::bind(&FunctionWidget::onObjectsChanged, this, _1, _2)); + m_connection = m_object->getDocument()->signalChangedObject.connect(boost::bind(&FunctionWidget::onObjectsChanged, this, bp::_1, bp::_2)); } void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) { diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index d4adbcebe6..1319f875d5 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp +++ b/src/Mod/Inspection/App/InspectionFeature.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include @@ -59,6 +59,7 @@ using namespace Inspection; +namespace bp = boost::placeholders; InspectActualMesh::InspectActualMesh(const Mesh::MeshObject& rMesh) : _mesh(rMesh.getKernel()) { @@ -786,7 +787,7 @@ App::DocumentObjectExecReturn* Feature::execute(void) std::generate(index.begin(), index.end(), Base::iotaGen(0)); DistanceInspection check(this->SearchRadius.getValue(), actual, inspectNominal); QFuture future = QtConcurrent::mapped - (index, boost::bind(&DistanceInspection::mapped, &check, _1)); + (index, boost::bind(&DistanceInspection::mapped, &check, bp::_1)); //future.waitForFinished(); // blocks the GUI Base::FutureWatcherProgress progress("Inspecting...", actual->countPoints()); QFutureWatcher watcher; diff --git a/src/Mod/Mesh/App/Core/Curvature.cpp b/src/Mod/Mesh/App/Core/Curvature.cpp index a517bd5edf..20d374a867 100644 --- a/src/Mod/Mesh/App/Core/Curvature.cpp +++ b/src/Mod/Mesh/App/Core/Curvature.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include //#define OPTIMIZE_CURVATURE #ifdef OPTIMIZE_CURVATURE @@ -48,6 +48,7 @@ #include using namespace MeshCore; +namespace bp = boost::placeholders; MeshCurvature::MeshCurvature(const MeshKernel& kernel) : myKernel(kernel), myMinPoints(20), myRadius(0.5f) @@ -79,7 +80,7 @@ void MeshCurvature::ComputePerFace(bool parallel) } else { QFuture future = QtConcurrent::mapped - (mySegment, boost::bind(&FacetCurvature::Compute, &face, _1)); + (mySegment, boost::bind(&FacetCurvature::Compute, &face, bp::_1)); QFutureWatcher watcher; watcher.setFuture(future); watcher.waitForFinished(); diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 79a6e02041..1d1e984d1a 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -31,8 +31,6 @@ #include "ui_DlgEvaluateMesh.h" #include "DlgEvaluateSettings.h" -#include - #include #include #include diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index 30cc2295fb..26eb872a5d 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -45,7 +45,7 @@ # include # include # include -# include +# include #endif #include "MeshEditor.h" @@ -61,6 +61,7 @@ #include using namespace MeshGui; +namespace bp = boost::placeholders; PROPERTY_SOURCE(MeshGui::ViewProviderFace, Gui::ViewProviderDocumentObject) @@ -477,7 +478,7 @@ void MeshFillHole::startEditing(MeshGui::ViewProviderMesh* vp) viewer->addEventCallback(SoEvent::getClassTypeId(), MeshFillHole::fileHoleCallback, this); myConnection = App::GetApplication().signalChangedObject.connect( - boost::bind(&MeshFillHole::slotChangedObject, this, _1, _2)); + boost::bind(&MeshFillHole::slotChangedObject, this, bp::_1, bp::_2)); Gui::coinRemoveAllChildren(myBoundariesRoot); myBoundariesRoot->addChild(viewer->getHeadlight()); diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 2ca8829ec7..311eeb6063 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -57,7 +57,7 @@ #include #include #include -#include +#include /// Here the FreeCAD includes sorted by Base,App,Gui...... #include @@ -100,7 +100,6 @@ #include #include #include -#include #include "ViewProvider.h" #include "SoFCIndexedFaceSet.h" @@ -108,6 +107,7 @@ using namespace MeshGui; +namespace bp = boost::placeholders; using Mesh::Feature; using MeshCore::MeshKernel; @@ -739,13 +739,13 @@ void ViewProviderMesh::setupContextMenu(QMenu* menu, QObject* receiver, const ch act->setCheckable(true); act->setChecked(pcMatBinding->value.getValue() == SoMaterialBinding::PER_FACE && highlightMode == "Component"); - func->toggle(act, boost::bind(&ViewProviderMesh::setHighlightedComponents, this, _1)); + func->toggle(act, boost::bind(&ViewProviderMesh::setHighlightedComponents, this, bp::_1)); QAction* seg = menu->addAction(QObject::tr("Display segments")); seg->setCheckable(true); seg->setChecked(pcMatBinding->value.getValue() == SoMaterialBinding::PER_FACE && highlightMode == "Segment"); - func->toggle(seg, boost::bind(&ViewProviderMesh::setHighlightedSegments, this, _1)); + func->toggle(seg, boost::bind(&ViewProviderMesh::setHighlightedSegments, this, bp::_1)); } bool ViewProviderMesh::setEdit(int ModNum) @@ -1383,7 +1383,7 @@ std::vector ViewProviderMesh::getVisibleFacets(const SbViewportRe Vertex v(kernel, grid, Base::convertTo(pos)); QFuture future = QtConcurrent::mapped - (points, boost::bind(&Vertex::visible, &v, _1)); + (points, boost::bind(&Vertex::visible, &v, bp::_1)); QFutureWatcher watcher; watcher.setFuture(future); watcher.waitForFinished(); diff --git a/src/Mod/MeshPart/Gui/CrossSections.cpp b/src/Mod/MeshPart/Gui/CrossSections.cpp index 9399cac146..bd23f4331d 100644 --- a/src/Mod/MeshPart/Gui/CrossSections.cpp +++ b/src/Mod/MeshPart/Gui/CrossSections.cpp @@ -36,7 +36,7 @@ # include # include # include -# include +# include # include # include # include @@ -63,6 +63,7 @@ #include using namespace MeshPartGui; +namespace bp = boost::placeholders; namespace MeshPartGui { class ViewProviderCrossSections : public Gui::ViewProvider @@ -274,7 +275,7 @@ void CrossSections::apply() MeshCrossSection cs(kernel, grid, a, b, c, connectEdges, eps); QFuture< std::list > future = QtConcurrent::mapped - (d, boost::bind(&MeshCrossSection::section, &cs, _1)); + (d, boost::bind(&MeshCrossSection::section, &cs, bp::_1)); future.waitForFinished(); TopoDS_Compound comp; diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index 85b5469e58..da61465961 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -53,7 +53,7 @@ #endif #include -#include +#include #include #include #include @@ -74,6 +74,7 @@ #include "TopoShapePy.h" using namespace Part; +namespace bp = boost::placeholders; FC_LOG_LEVEL_INIT("Part",true,true) @@ -222,11 +223,11 @@ struct ShapeCache { return; inited = true; App::GetApplication().signalDeleteDocument.connect( - boost::bind(&ShapeCache::slotDeleteDocument, this, _1)); + boost::bind(&ShapeCache::slotDeleteDocument, this, bp::_1)); App::GetApplication().signalDeletedObject.connect( - boost::bind(&ShapeCache::slotClear, this, _1)); + boost::bind(&ShapeCache::slotClear, this, bp::_1)); App::GetApplication().signalChangedObject.connect( - boost::bind(&ShapeCache::slotChanged, this, _1,_2)); + boost::bind(&ShapeCache::slotChanged, this, bp::_1,bp::_2)); } void slotDeleteDocument(const App::Document &doc) { diff --git a/src/Mod/Part/App/PreCompiled.h b/src/Mod/Part/App/PreCompiled.h index 1097bbb0da..19169f1141 100644 --- a/src/Mod/Part/App/PreCompiled.h +++ b/src/Mod/Part/App/PreCompiled.h @@ -77,7 +77,7 @@ // Boost #include -#include +#include #include #include diff --git a/src/Mod/Part/Gui/CrossSections.cpp b/src/Mod/Part/Gui/CrossSections.cpp index b28d86995c..b4fff085f5 100644 --- a/src/Mod/Part/Gui/CrossSections.cpp +++ b/src/Mod/Part/Gui/CrossSections.cpp @@ -36,7 +36,7 @@ # include # include # include -# include +# include # include # include # include @@ -61,6 +61,7 @@ #include using namespace PartGui; +namespace bp = boost::placeholders; #undef CS_FUTURE // multi-threading causes some problems namespace PartGui { @@ -218,7 +219,7 @@ void CrossSections::apply() for (std::vector::iterator it = obj.begin(); it != obj.end(); ++it) { Part::CrossSection cs(a,b,c,static_cast(*it)->Shape.getValue()); QFuture< std::list > future = QtConcurrent::mapped - (d, boost::bind(&Part::CrossSection::section, &cs, _1)); + (d, boost::bind(&Part::CrossSection::section, &cs, bp::_1)); future.waitForFinished(); QFuture< std::list >::const_iterator ft; TopoDS_Compound comp; diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.cpp b/src/Mod/Part/Gui/DlgBooleanOperation.cpp index 9df2d38994..edd3cd06b8 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.cpp +++ b/src/Mod/Part/Gui/DlgBooleanOperation.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include #endif #include "DlgBooleanOperation.h" @@ -47,6 +47,7 @@ #include using namespace PartGui; +namespace bp = boost::placeholders; namespace PartGui { class BooleanOperationItem : public QTreeWidgetItem @@ -89,9 +90,9 @@ DlgBooleanOperation::DlgBooleanOperation(QWidget* parent) connect(ui->secondShape, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); this->connectNewObject = App::GetApplication().signalNewObject.connect(boost::bind - (&DlgBooleanOperation::slotCreatedObject, this, _1)); + (&DlgBooleanOperation::slotCreatedObject, this, bp::_1)); this->connectModObject = App::GetApplication().signalChangedObject.connect(boost::bind - (&DlgBooleanOperation::slotChangedObject, this, _1, _2)); + (&DlgBooleanOperation::slotChangedObject, this, bp::_1, bp::_2)); findShapes(); } diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index 766d798d18..3749cbcdec 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -43,7 +43,7 @@ # include # include # include -# include +# include # include # include # include @@ -75,6 +75,7 @@ #include using namespace PartGui; +namespace bp = boost::placeholders; FilletRadiusDelegate::FilletRadiusDelegate(QObject *parent) : QItemDelegate(parent) { @@ -245,9 +246,9 @@ DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidge d->fillet = fillet; d->connectApplicationDeletedObject = App::GetApplication().signalDeletedObject - .connect(boost::bind(&DlgFilletEdges::onDeleteObject, this, _1)); + .connect(boost::bind(&DlgFilletEdges::onDeleteObject, this, bp::_1)); d->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument - .connect(boost::bind(&DlgFilletEdges::onDeleteDocument, this, _1)); + .connect(boost::bind(&DlgFilletEdges::onDeleteDocument, this, bp::_1)); // set tree view with three columns QStandardItemModel* model = new FilletRadiusModel(this); connect(model, SIGNAL(toggleCheckState(const QModelIndex&)), diff --git a/src/Mod/Part/Gui/Mirroring.cpp b/src/Mod/Part/Gui/Mirroring.cpp index 535507cbf9..94beb847b2 100644 --- a/src/Mod/Part/Gui/Mirroring.cpp +++ b/src/Mod/Part/Gui/Mirroring.cpp @@ -28,7 +28,6 @@ # include # include # include -# include # include # include # include diff --git a/src/Mod/Part/Gui/PreCompiled.h b/src/Mod/Part/Gui/PreCompiled.h index ab8630aa2f..aae042adb1 100644 --- a/src/Mod/Part/Gui/PreCompiled.h +++ b/src/Mod/Part/Gui/PreCompiled.h @@ -176,7 +176,7 @@ // Boost #include -#include +#include // Qt Toolkit #ifndef __Qt4All__ diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 3e06235eca..256c68f4df 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -31,7 +31,7 @@ # include # include # include -# include +# include #endif #include @@ -62,6 +62,7 @@ using namespace PartGui; using namespace Gui; using namespace Attacher; +namespace bp = boost::placeholders; /* TRANSLATOR PartDesignGui::TaskAttacher */ @@ -217,8 +218,8 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidge updatePreview(); // connect object deletion with slot - auto bnd1 = boost::bind(&TaskAttacher::objectDeleted, this, _1); - auto bnd2 = boost::bind(&TaskAttacher::documentDeleted, this, _1); + auto bnd1 = boost::bind(&TaskAttacher::objectDeleted, this, bp::_1); + auto bnd2 = boost::bind(&TaskAttacher::documentDeleted, this, bp::_1); Gui::Document* document = Gui::Application::Instance->getDocument(ViewProvider->getObject()->getDocument()); connectDelObject = document->signalDeletedObject.connect(bnd1); connectDelDocument = document->signalDeleteDocument.connect(bnd2); diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index 33fb96f02d..28852f4043 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include # include # include @@ -79,6 +79,8 @@ #include "TaskDimension.h" +namespace bp = boost::placeholders; + static bool _MeasureInfoInited; static void slotDeleteDocument(const App::Document &doc); @@ -92,7 +94,7 @@ struct MeasureInfo { { if(!_MeasureInfoInited) { _MeasureInfoInited = true; - App::GetApplication().signalDeleteDocument.connect(boost::bind(slotDeleteDocument, _1)); + App::GetApplication().signalDeleteDocument.connect(boost::bind(slotDeleteDocument, bp::_1)); } } }; diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 5629beab81..1549e3ba22 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -44,7 +44,7 @@ # include # include # include -# include +# include #endif #include "ui_TaskFaceColors.h" @@ -68,6 +68,7 @@ using namespace PartGui; +namespace bp = boost::placeholders; namespace PartGui { class FaceSelection : public Gui::SelectionFilterGate @@ -274,11 +275,11 @@ FaceColors::FaceColors(ViewProviderPartExt* vp, QWidget* parent) Gui::Selection().addSelectionGate(gate); d->connectDelDoc = Gui::Application::Instance->signalDeleteDocument.connect(boost::bind - (&FaceColors::slotDeleteDocument, this, _1)); + (&FaceColors::slotDeleteDocument, this, bp::_1)); d->connectDelObj = Gui::Application::Instance->signalDeletedObject.connect(boost::bind - (&FaceColors::slotDeleteObject, this, _1)); + (&FaceColors::slotDeleteObject, this, bp::_1)); d->connectUndoDoc = d->doc->signalUndoDocument.connect(boost::bind - (&FaceColors::slotUndoDocument, this, _1)); + (&FaceColors::slotUndoDocument, this, bp::_1)); } FaceColors::~FaceColors() diff --git a/src/Mod/Part/Gui/ViewProviderSpline.cpp b/src/Mod/Part/Gui/ViewProviderSpline.cpp index 916af374ad..8e1373a78e 100644 --- a/src/Mod/Part/Gui/ViewProviderSpline.cpp +++ b/src/Mod/Part/Gui/ViewProviderSpline.cpp @@ -45,7 +45,7 @@ # include # include # include -# include +# include #endif #include @@ -56,6 +56,7 @@ using namespace PartGui; +namespace bp = boost::placeholders; PROPERTY_SOURCE(PartGui::ViewProviderSpline, PartGui::ViewProviderPartExt) @@ -79,7 +80,7 @@ void ViewProviderSpline::setupContextMenu(QMenu* menu, QObject* receiver, const QAction* act = menu->addAction(QObject::tr("Show control points")); act->setCheckable(true); act->setChecked(ControlPoints.getValue()); - func->toggle(act, boost::bind(&ViewProviderSpline::toggleControlPoints, this, _1)); + func->toggle(act, boost::bind(&ViewProviderSpline::toggleControlPoints, this, bp::_1)); } void ViewProviderSpline::toggleControlPoints(bool on) diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index 448f558546..d29e5b90d6 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -24,7 +24,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include #endif #include diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 1fec0b1c89..8c925a860a 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include # include # include # include @@ -51,6 +51,7 @@ FC_LOG_LEVEL_INIT("PartDesign",true,true) #endif using namespace PartDesign; +namespace bp = boost::placeholders; // ============================================================================ @@ -229,7 +230,7 @@ void ShapeBinder::onSettingDocument() App::Document* document = getDocument(); if (document) { this->connectDocumentChangedObject = document->signalChangedObject.connect(boost::bind - (&ShapeBinder::slotChangedObject, this, _1, _2)); + (&ShapeBinder::slotChangedObject, this, bp::_1, bp::_2)); } } @@ -608,7 +609,7 @@ void SubShapeBinder::onChanged(const App::Property *prop) { { contextDoc = Context.getValue()->getDocument(); connRecomputedObj = contextDoc->signalRecomputedObject.connect( - boost::bind(&SubShapeBinder::slotRecomputedObject, this, _1)); + boost::bind(&SubShapeBinder::slotRecomputedObject, this, bp::_1)); } }else if(!isRestoring()) { if(prop == &Support) { diff --git a/src/Mod/PartDesign/Gui/PreCompiled.h b/src/Mod/PartDesign/Gui/PreCompiled.h index 9604a6a95a..65a4997693 100644 --- a/src/Mod/PartDesign/Gui/PreCompiled.h +++ b/src/Mod/PartDesign/Gui/PreCompiled.h @@ -62,7 +62,7 @@ #include // Boost -#include +#include // OCC #include diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index aa8c4868cc..f127a03252 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -31,7 +31,6 @@ # include # include # include -# include #endif #include diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 4a41cf28b6..ed68b24aff 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -25,7 +25,7 @@ #ifndef _PreComp_ # include -# include +# include #endif #include "ui_TaskHoleParameters.h" @@ -43,6 +43,7 @@ using namespace PartDesignGui; using namespace Gui; +namespace bp = boost::placeholders; /* TRANSLATOR PartDesignGui::TaskHoleParameters */ @@ -118,7 +119,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare ui->TaperedAngle->bind(pcHole->TaperedAngle); connectPropChanged = App::GetApplication().signalChangePropertyEditor.connect( - boost::bind(&TaskHoleParameters::changedObject, this, _1, _2)); + boost::bind(&TaskHoleParameters::changedObject, this, bp::_1, bp::_2)); this->groupLayout()->addWidget(proxy); } diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.h b/src/Mod/PartDesign/Gui/TaskHoleParameters.h index 447197c2b9..62d062f342 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.h +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "TaskSketchBasedParameters.h" #include "ViewProviderHole.h" diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp index 65a08a489a..671d0a76c5 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp @@ -29,8 +29,6 @@ # include # include # include -# include -# include #endif #include "TaskPrimitiveParameters.h" diff --git a/src/Mod/PartDesign/Gui/TaskTransformedMessages.cpp b/src/Mod/PartDesign/Gui/TaskTransformedMessages.cpp index 7eb917bfd9..de2f6587e0 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedMessages.cpp +++ b/src/Mod/PartDesign/Gui/TaskTransformedMessages.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include "ui_TaskTransformedMessages.h" @@ -37,6 +37,7 @@ using namespace PartDesignGui; using namespace Gui::TaskView; +namespace bp = boost::placeholders; TaskTransformedMessages::TaskTransformedMessages(ViewProviderTransformed *transformedView_) : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Transformed feature messages"),true, 0), @@ -54,7 +55,7 @@ TaskTransformedMessages::TaskTransformedMessages(ViewProviderTransformed *transf this->groupLayout()->addWidget(proxy); ui->labelTransformationStatus->setText(transformedView->getMessage()); - connectionDiagnosis = transformedView->signalDiagnosis.connect(boost::bind(&PartDesignGui::TaskTransformedMessages::slotDiagnosis, this,_1)); + connectionDiagnosis = transformedView->signalDiagnosis.connect(boost::bind(&PartDesignGui::TaskTransformedMessages::slotDiagnosis, this, bp::_1)); } TaskTransformedMessages::~TaskTransformedMessages() diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index 92dd603ed7..96618725b7 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include # include # include @@ -60,6 +60,7 @@ #include using namespace PartDesignGui; +namespace bp = boost::placeholders; const char* PartDesignGui::ViewProviderBody::BodyModeEnum[] = {"Through","Tip",NULL}; @@ -96,10 +97,10 @@ void ViewProviderBody::attach(App::DocumentObject *pcFeat) assert ( gdoc ); connectChangedObjectApp = adoc->signalChangedObject.connect ( - boost::bind ( &ViewProviderBody::slotChangedObjectApp, this, _1, _2) ); + boost::bind ( &ViewProviderBody::slotChangedObjectApp, this, bp::_1, bp::_2) ); connectChangedObjectGui = gdoc->signalChangedObject.connect ( - boost::bind ( &ViewProviderBody::slotChangedObjectGui, this, _1, _2) ); + boost::bind ( &ViewProviderBody::slotChangedObjectGui, this, bp::_1, bp::_2) ); } // TODO on activating the body switch to the "Through" mode (2015-09-05, Fat-Zer) diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index b8489d36fe..b65243eb64 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include # include #endif @@ -46,6 +46,7 @@ #include "WorkflowManager.h" using namespace PartDesignGui; +namespace bp = boost::placeholders; #if 0 // needed for Qt's lupdate utility qApp->translate("Workbench", "Part Design"); @@ -433,22 +434,22 @@ void Workbench::activated() Gui::Control().showTaskView(); // Let us be notified when a document is activated, so that we can update the ActivePartObject - Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, _1)); - App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, _1)); - App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, _1)); - App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, _1)); + Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); + App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); + App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); + App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); // Watch out for objects being added to the active document, so that we can add them to the body - //App::GetApplication().signalNewObject.connect(boost::bind(&Workbench::slotNewObject, this, _1)); + //App::GetApplication().signalNewObject.connect(boost::bind(&Workbench::slotNewObject, this, bp::_1)); } void Workbench::deactivated() { // Let us be notified when a document is activated, so that we can update the ActivePartObject - Gui::Application::Instance->signalActiveDocument.disconnect(boost::bind(&Workbench::slotActiveDocument, this, _1)); - App::GetApplication().signalNewDocument.disconnect(boost::bind(&Workbench::slotNewDocument, this, _1)); - App::GetApplication().signalFinishRestoreDocument.disconnect(boost::bind(&Workbench::slotFinishRestoreDocument, this, _1)); - App::GetApplication().signalDeleteDocument.disconnect(boost::bind(&Workbench::slotDeleteDocument, this, _1)); - //App::GetApplication().signalNewObject.disconnect(boost::bind(&Workbench::slotNewObject, this, _1)); + Gui::Application::Instance->signalActiveDocument.disconnect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); + App::GetApplication().signalNewDocument.disconnect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); + App::GetApplication().signalFinishRestoreDocument.disconnect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); + App::GetApplication().signalDeleteDocument.disconnect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); + //App::GetApplication().signalNewObject.disconnect(boost::bind(&Workbench::slotNewObject, this, bp::_1)); removeTaskWatcher(); // reset the active Body diff --git a/src/Mod/PartDesign/Gui/WorkflowManager.cpp b/src/Mod/PartDesign/Gui/WorkflowManager.cpp index b769510858..47bff55e68 100644 --- a/src/Mod/PartDesign/Gui/WorkflowManager.cpp +++ b/src/Mod/PartDesign/Gui/WorkflowManager.cpp @@ -26,7 +26,7 @@ # include # include # include -# include +# include # include # include #endif @@ -43,6 +43,7 @@ using namespace PartDesignGui; +namespace bp = boost::placeholders; WorkflowManager * WorkflowManager::_instance = nullptr; @@ -55,11 +56,11 @@ WorkflowManager::WorkflowManager() { } connectNewDocument = App::GetApplication().signalNewDocument.connect( - boost::bind( &WorkflowManager::slotNewDocument, this, _1 ) ); + boost::bind( &WorkflowManager::slotNewDocument, this, bp::_1 ) ); connectFinishRestoreDocument = App::GetApplication().signalFinishRestoreDocument.connect( - boost::bind( &WorkflowManager::slotFinishRestoreDocument, this, _1 ) ); + boost::bind( &WorkflowManager::slotFinishRestoreDocument, this, bp::_1 ) ); connectDeleteDocument = App::GetApplication().signalDeleteDocument.connect( - boost::bind( &WorkflowManager::slotDeleteDocument, this, _1 ) ); + boost::bind( &WorkflowManager::slotDeleteDocument, this, bp::_1 ) ); } WorkflowManager::~WorkflowManager() { diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 8101ef21b0..436a5f044c 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -21,6 +21,9 @@ ****************************************************************************/ #include "PreCompiled.h" +// From Boost 1.75 on the geometry component requires C++14 +#define BOOST_GEOMETRY_DISABLE_DEPRECATED_03_WARNING + #ifndef _PreComp_ # include # include diff --git a/src/Mod/Path/libarea/PythonStuff.cpp b/src/Mod/Path/libarea/PythonStuff.cpp index f9fb200376..7f58e8eead 100644 --- a/src/Mod/Path/libarea/PythonStuff.cpp +++ b/src/Mod/Path/libarea/PythonStuff.cpp @@ -30,8 +30,10 @@ #pragma implementation #endif -#include -#include +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + +//#include +//#include #include #include #include diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index f8654163a2..7173b334fd 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -40,6 +40,7 @@ #include "ApproxSurface.h" using namespace Reen; +namespace bp = boost::placeholders; // SplineBasisfunction @@ -1090,7 +1091,7 @@ bool BSplineParameterCorrection::SolveWithSmoothing(double fWeight) std::generate(columns.begin(), columns.end(), Base::iotaGen(0)); ScalarProduct scalar(M); QFuture< std::vector > future = QtConcurrent::mapped - (columns, boost::bind(&ScalarProduct::multiply, &scalar, _1)); + (columns, boost::bind(&ScalarProduct::multiply, &scalar, bp::_1)); QFutureWatcher< std::vector > watcher; watcher.setFuture(future); watcher.waitForFinished(); diff --git a/src/Mod/Sandbox/App/DocumentProtector.h b/src/Mod/Sandbox/App/DocumentProtector.h index 603b92932a..f44aebdb52 100644 --- a/src/Mod/Sandbox/App/DocumentProtector.h +++ b/src/Mod/Sandbox/App/DocumentProtector.h @@ -25,7 +25,6 @@ #define SANDBOX_DOCUMENTPROTECTOR_H #include -#include #include namespace App { diff --git a/src/Mod/Sandbox/Gui/Command.cpp b/src/Mod/Sandbox/Gui/Command.cpp index 67db11a1e3..81158c70b2 100644 --- a/src/Mod/Sandbox/Gui/Command.cpp +++ b/src/Mod/Sandbox/Gui/Command.cpp @@ -56,7 +56,7 @@ # if BOOST_VERSION >= 104100 # include # endif -# include +# include # include #endif @@ -81,6 +81,8 @@ #include "GLGraphicsView.h" #include "TaskPanelView.h" +namespace bp = boost::placeholders; + DEF_STD_CMD(CmdSandboxDocumentThread); CmdSandboxDocumentThread::CmdSandboxDocumentThread() @@ -829,7 +831,7 @@ void CmdSandboxMeshTestJob::activated(int) Base::Console().Message("Mesh test (step %d)...\n",iteration++); MeshTestJob meshJob; QFuture mesh_future = QtConcurrent::mapped - (mesh_groups, boost::bind(&MeshTestJob::run, &meshJob, _1)); + (mesh_groups, boost::bind(&MeshTestJob::run, &meshJob, bp::_1)); // keep it responsive during computation QFutureWatcher mesh_watcher; diff --git a/src/Mod/Sandbox/Gui/TaskPanelView.cpp b/src/Mod/Sandbox/Gui/TaskPanelView.cpp index 92f709608d..ad2e78b1ad 100644 --- a/src/Mod/Sandbox/Gui/TaskPanelView.cpp +++ b/src/Mod/Sandbox/Gui/TaskPanelView.cpp @@ -25,7 +25,7 @@ /// Here the FreeCAD includes sorted by Base,App,Gui...... -#include +#include #include #include #include @@ -55,6 +55,7 @@ using namespace SandboxGui; +namespace bp = boost::placeholders; #if defined(QSINT_ACTIONPANEL) @@ -557,27 +558,27 @@ TaskPanelView::TaskPanelView(QWidget *parent) QAction* defaultAction = new QAction(this); connect(ui->rbDefaultScheme, SIGNAL(toggled(bool)), defaultAction, SIGNAL(toggled(bool))); - func->toggle(defaultAction, boost::bind(&TaskPanelView::on_rbDefaultScheme_toggled, this, _1)); + func->toggle(defaultAction, boost::bind(&TaskPanelView::on_rbDefaultScheme_toggled, this, bp::_1)); QAction* xpBlueAction = new QAction(this); connect(ui->rbXPBlueScheme, SIGNAL(toggled(bool)), xpBlueAction, SIGNAL(toggled(bool))); - func->toggle(xpBlueAction, boost::bind(&TaskPanelView::on_rbXPBlueScheme_toggled, this, _1)); + func->toggle(xpBlueAction, boost::bind(&TaskPanelView::on_rbXPBlueScheme_toggled, this, bp::_1)); QAction* xpBlue2Action = new QAction(this); connect(ui->rbXPBlue2Scheme, SIGNAL(toggled(bool)), xpBlue2Action, SIGNAL(toggled(bool))); - func->toggle(xpBlue2Action, boost::bind(&TaskPanelView::on_rbXPBlue2Scheme_toggled, this, _1)); + func->toggle(xpBlue2Action, boost::bind(&TaskPanelView::on_rbXPBlue2Scheme_toggled, this, bp::_1)); QAction* vistaAction = new QAction(this); connect(ui->rbVistaScheme, SIGNAL(toggled(bool)), vistaAction, SIGNAL(toggled(bool))); - func->toggle(vistaAction, boost::bind(&TaskPanelView::on_rbVistaScheme_toggled, this, _1)); + func->toggle(vistaAction, boost::bind(&TaskPanelView::on_rbVistaScheme_toggled, this, bp::_1)); QAction* macAction = new QAction(this); connect(ui->rbMacScheme, SIGNAL(toggled(bool)), macAction, SIGNAL(toggled(bool))); - func->toggle(macAction, boost::bind(&TaskPanelView::on_rbMacScheme_toggled, this, _1)); + func->toggle(macAction, boost::bind(&TaskPanelView::on_rbMacScheme_toggled, this, bp::_1)); QAction* androidAction = new QAction(this); connect(ui->rbAndroidScheme, SIGNAL(toggled(bool)), androidAction, SIGNAL(toggled(bool))); - func->toggle(androidAction, boost::bind(&TaskPanelView::on_rbAndroidScheme_toggled, this, _1)); + func->toggle(androidAction, boost::bind(&TaskPanelView::on_rbAndroidScheme_toggled, this, bp::_1)); } #else setWindowTitle(QLatin1String("Task View")); diff --git a/src/Mod/Sketcher/App/PreCompiled.h b/src/Mod/Sketcher/App/PreCompiled.h index 4ead9d89c1..db682910cd 100644 --- a/src/Mod/Sketcher/App/PreCompiled.h +++ b/src/Mod/Sketcher/App/PreCompiled.h @@ -59,7 +59,7 @@ #include // Boost -#include +#include #include // Opencascade diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 8cab499cc8..64a5fae757 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -58,7 +58,7 @@ # include # include # include -# include +# include //# include #endif @@ -88,6 +88,7 @@ using namespace Sketcher; using namespace Base; +namespace bp = boost::placeholders; FC_LOG_LEVEL_INIT("Sketch",true,true) @@ -134,10 +135,10 @@ SketchObject::SketchObject() noRecomputes=false; - ExpressionEngine.setValidator(boost::bind(&Sketcher::SketchObject::validateExpression, this, _1, _2)); + ExpressionEngine.setValidator(boost::bind(&Sketcher::SketchObject::validateExpression, this, bp::_1, bp::_2)); - constraintsRemovedConn = Constraints.signalConstraintsRemoved.connect(boost::bind(&Sketcher::SketchObject::constraintsRemoved, this, _1)); - constraintsRenamedConn = Constraints.signalConstraintsRenamed.connect(boost::bind(&Sketcher::SketchObject::constraintsRenamed, this, _1)); + constraintsRemovedConn = Constraints.signalConstraintsRemoved.connect(boost::bind(&Sketcher::SketchObject::constraintsRemoved, this, bp::_1)); + constraintsRenamedConn = Constraints.signalConstraintsRenamed.connect(boost::bind(&Sketcher::SketchObject::constraintsRenamed, this, bp::_1)); analyser = new SketchAnalysis(this); } diff --git a/src/Mod/Sketcher/Gui/PreCompiled.h b/src/Mod/Sketcher/Gui/PreCompiled.h index 19de7b0c2e..d8ec53b102 100644 --- a/src/Mod/Sketcher/Gui/PreCompiled.h +++ b/src/Mod/Sketcher/Gui/PreCompiled.h @@ -67,7 +67,7 @@ // Boost #include -#include +#include #include #ifdef FC_OS_WIN32 diff --git a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp index 06d0cb3c99..c61cbf241e 100644 --- a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp +++ b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include "TaskDlgEditSketch.h" @@ -32,6 +32,7 @@ #include using namespace SketcherGui; +namespace bp = boost::placeholders; //************************************************************************** @@ -75,9 +76,9 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView) App::Document* document = sketchView->getObject()->getDocument(); connectUndoDocument = - document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, _1)); + document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, bp::_1)); connectRedoDocument = - document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, _1)); + document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, bp::_1)); } TaskDlgEditSketch::~TaskDlgEditSketch() diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index f376e4ad2d..521d8be7ea 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -33,7 +33,7 @@ # include # include # include -# include +# include #endif #include "TaskSketcherConstrains.h" diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 1a43878cab..8833277958 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -31,7 +31,7 @@ # include # include # include -# include +# include #endif #include "TaskSketcherElements.h" diff --git a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp index e8bf2a629d..771e6f795e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include +#include #endif #include "ui_TaskSketcherGeneral.h" @@ -43,6 +43,7 @@ using namespace SketcherGui; using namespace Gui::TaskView; +namespace bp = boost::placeholders; SketcherGeneralWidget::SketcherGeneralWidget(QWidget *parent) : QWidget(parent), ui(new Ui_TaskSketcherGeneral) @@ -250,7 +251,7 @@ TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView) Gui::Application* app = Gui::Application::Instance; changedSketchView = app->signalChangedObject.connect(boost::bind - (&TaskSketcherGeneral::onChangedSketchView, this, _1, _2)); + (&TaskSketcherGeneral::onChangedSketchView, this, bp::_1, bp::_2)); } TaskSketcherGeneral::~TaskSketcherGeneral() diff --git a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp index 6ef662acee..2aef84760e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +# include #endif #include "ui_TaskSketcherMessages.h" @@ -45,6 +45,7 @@ using namespace SketcherGui; using namespace Gui::TaskView; +namespace bp = boost::placeholders; TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Solver messages"),true, 0) @@ -58,8 +59,8 @@ TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) this->groupLayout()->addWidget(proxy); - connectionSetUp = sketchView->signalSetUp.connect(boost::bind(&SketcherGui::TaskSketcherMessages::slotSetUp, this,_1)); - connectionSolved = sketchView->signalSolved.connect(boost::bind(&SketcherGui::TaskSketcherMessages::slotSolved, this,_1)); + connectionSetUp = sketchView->signalSetUp.connect(boost::bind(&SketcherGui::TaskSketcherMessages::slotSetUp, this, bp::_1)); + connectionSolved = sketchView->signalSolved.connect(boost::bind(&SketcherGui::TaskSketcherMessages::slotSolved, this, bp::_1)); ui->labelConstrainStatus->setOpenExternalLinks(false); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp index ef6a30c60c..cf6769a11a 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp @@ -24,7 +24,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include # include #endif diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 5ddc2052cb..dccd9f0f04 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -71,7 +71,7 @@ # include # include -# include +# include # include #endif @@ -138,6 +138,7 @@ FC_LOG_LEVEL_INIT("Sketch",true,true) using namespace SketcherGui; using namespace Sketcher; +namespace bp = boost::placeholders; SbColor ViewProviderSketch::VertexColor (1.0f,0.149f,0.0f); // #FF2600 -> (255, 38, 0) SbColor ViewProviderSketch::CurveColor (1.0f,1.0f,1.0f); // #FFFFFF -> (255,255,255) @@ -5775,9 +5776,9 @@ bool ViewProviderSketch::setEdit(int ModNum) draw(false,true); connectUndoDocument = getDocument() - ->signalUndoDocument.connect(boost::bind(&ViewProviderSketch::slotUndoDocument, this, _1)); + ->signalUndoDocument.connect(boost::bind(&ViewProviderSketch::slotUndoDocument, this, bp::_1)); connectRedoDocument = getDocument() - ->signalRedoDocument.connect(boost::bind(&ViewProviderSketch::slotRedoDocument, this, _1)); + ->signalRedoDocument.connect(boost::bind(&ViewProviderSketch::slotRedoDocument, this, bp::_1)); // Enable solver initial solution update while dragging. ParameterGrp::handle hGrp2 = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index a9a7afdd2d..debed472d2 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,6 +49,7 @@ FC_LOG_LEVEL_INIT("Spreadsheet", true, true) using namespace App; using namespace Base; using namespace Spreadsheet; +namespace bp = boost::placeholders; TYPESYSTEM_SOURCE(Spreadsheet::PropertySheet , App::PropertyExpressionContainer) @@ -682,7 +683,7 @@ void PropertySheet::insertRows(int row, int count) boost::copy( data | boost::adaptors::map_keys, std::back_inserter(keys)); /* Sort them */ - std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::rowSortFunc, this, _1, _2)); + std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::rowSortFunc, this, bp::_1, bp::_2)); MoveCellsExpressionVisitor visitor(*this, CellAddress(row, CellAddress::MAX_COLUMNS), count, 0); @@ -733,7 +734,7 @@ void PropertySheet::removeRows(int row, int count) boost::copy(data | boost::adaptors::map_keys, std::back_inserter(keys)); /* Sort them */ - std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::rowSortFunc, this, _1, _2)); + std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::rowSortFunc, this, bp::_1, bp::_2)); MoveCellsExpressionVisitor visitor(*this, CellAddress(row + count - 1, CellAddress::MAX_COLUMNS), -count, 0); @@ -825,7 +826,7 @@ void PropertySheet::removeColumns(int col, int count) boost::copy(data | boost::adaptors::map_keys, std::back_inserter(keys)); /* Sort them */ - std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::colSortFunc, this, _1, _2)); + std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::colSortFunc, this, bp::_1, bp::_2)); MoveCellsExpressionVisitor visitor(*this, CellAddress(CellAddress::MAX_ROWS, col + count - 1), 0, -count); @@ -1129,7 +1130,7 @@ void PropertySheet::slotChangedObject(const App::DocumentObject &obj, const App: void PropertySheet::onAddDep(App::DocumentObject *obj) { depConnections[obj] = obj->signalChanged.connect(boost::bind( - &PropertySheet::slotChangedObject, this, _1, _2)); + &PropertySheet::slotChangedObject, this, bp::_1, bp::_2)); } void PropertySheet::onRemoveDep(App::DocumentObject *obj) { diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index cc254ed9b2..648db5096a 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include FC_LOG_LEVEL_INIT("Spreadsheet",true,true) diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index a95b430cdd..8f3d9ad7a7 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -38,17 +38,18 @@ #include #include #include -#include +#include using namespace SpreadsheetGui; using namespace Spreadsheet; using namespace App; +namespace bp = boost::placeholders; SheetModel::SheetModel(Sheet *_sheet, QObject *parent) : QAbstractTableModel(parent) , sheet(_sheet) { - cellUpdatedConnection = sheet->cellUpdated.connect(bind(&SheetModel::cellUpdated, this, _1)); + cellUpdatedConnection = sheet->cellUpdated.connect(bind(&SheetModel::cellUpdated, this, bp::_1)); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Spreadsheet"); aliasBgColor = QColor(Base::Tools::fromStdString(hGrp->GetASCII("AliasedCellBackgroundColor", "#feff9e"))); diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index 8285e1520e..081ca51500 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../App/Utils.h" #include "../App/Cell.h" #include @@ -46,6 +46,7 @@ using namespace SpreadsheetGui; using namespace Spreadsheet; using namespace App; +namespace bp = boost::placeholders; void SheetViewHeader::mouseReleaseEvent(QMouseEvent *event) { @@ -279,7 +280,7 @@ void SheetTableView::updateCellSpan(CellAddress address) void SheetTableView::setSheet(Sheet * _sheet) { sheet = _sheet; - cellSpanChangedConnection = sheet->cellSpanChanged.connect(bind(&SheetTableView::updateCellSpan, this, _1)); + cellSpanChangedConnection = sheet->cellSpanChanged.connect(bind(&SheetTableView::updateCellSpan, this, bp::_1)); // Update row and column spans std::vector usedCells = sheet->getUsedCells(); diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index ab9adac3e0..139b11eca5 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include "qtcolorpicker.h" #include @@ -59,6 +59,7 @@ using namespace SpreadsheetGui; using namespace Spreadsheet; using namespace Gui; using namespace App; +namespace bp = boost::placeholders; /* TRANSLATOR SpreadsheetGui::SheetView */ @@ -99,8 +100,8 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi connect(ui->cellContent, SIGNAL(returnPressed()), this, SLOT( editingFinished() )); connect(ui->cellAlias, SIGNAL(returnPressed()), this, SLOT( editingFinished() )); - columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, _1, _2)); - rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, _1, _2)); + columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, bp::_1, bp::_2)); + rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, bp::_1, bp::_2)); connect( model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(modelUpdated(const QModelIndex &, const QModelIndex &))); diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 21eff10d6e..6ec5b77130 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -40,7 +40,7 @@ #include #include #include - #include + #include #endif // #ifndef _PreComp_ @@ -109,6 +109,7 @@ using namespace TechDrawGui; +namespace bp = boost::placeholders; /* TRANSLATOR TechDrawGui::MDIViewPage */ @@ -163,7 +164,7 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget* //get informed by App side about deleted DocumentObjects App::Document* appDoc = m_vpPage->getDocument()->getDocument(); - auto bnd = boost::bind(&MDIViewPage::onDeleteObject, this, _1); + auto bnd = boost::bind(&MDIViewPage::onDeleteObject, this, bp::_1); connectDeletedObject = appDoc->signalDeletedObject.connect(bnd); } diff --git a/src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp b/src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp index 2235daf354..a0f6f5a4d2 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp @@ -27,7 +27,7 @@ #ifndef _PreComp_ #include #include -#include +#include #endif @@ -56,6 +56,7 @@ #include "ViewProviderDrawingView.h" using namespace TechDrawGui; +namespace bp = boost::placeholders; PROPERTY_SOURCE(TechDrawGui::ViewProviderDrawingView, Gui::ViewProviderDocumentObject) @@ -82,7 +83,7 @@ void ViewProviderDrawingView::attach(App::DocumentObject *pcFeat) // Base::Console().Message("VPDV::attach(%s)\n", pcFeat->getNameInDocument()); ViewProviderDocumentObject::attach(pcFeat); - auto bnd = boost::bind(&ViewProviderDrawingView::onGuiRepaint, this, _1); + auto bnd = boost::bind(&ViewProviderDrawingView::onGuiRepaint, this, bp::_1); auto feature = getViewObject(); if (feature != nullptr) { connectGuiRepaint = feature->signalGuiPaint.connect(bnd); diff --git a/src/Mod/TechDraw/Gui/ViewProviderPage.cpp b/src/Mod/TechDraw/Gui/ViewProviderPage.cpp index a10527be3b..f463d58096 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderPage.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderPage.cpp @@ -30,11 +30,11 @@ # include # include # include -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include #endif @@ -73,6 +73,7 @@ using namespace TechDrawGui; using namespace TechDraw; +namespace bp = boost::placeholders; #define _SHOWDRAWING 10 #define _TOGGLEUPDATE 11 @@ -107,7 +108,7 @@ void ViewProviderPage::attach(App::DocumentObject *pcFeat) { ViewProviderDocumentObject::attach(pcFeat); - auto bnd = boost::bind(&ViewProviderPage::onGuiRepaint, this, _1); + auto bnd = boost::bind(&ViewProviderPage::onGuiRepaint, this, bp::_1); auto feature = getDrawPage(); if (feature != nullptr) { connectGuiRepaint = feature->signalGuiPaint.connect(bnd); From 0f605989648a9573882bb6471dba6ee7b4f10320 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 9 Jun 2020 13:17:01 +0200 Subject: [PATCH 31/46] boost: remove broken define that causes a warning: ISO C++11 requires whitespace after the macro name --- src/App/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index bd275302ab..d97f8cd8d7 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -16,8 +16,6 @@ IF(DOCDIR) add_definitions(-DDOCDIR="${DOCDIR}") ENDIF(DOCDIR) -add_definitions(-DBOOST_${Boost_VERSION}) - #if you want to use the old DAG structure uncomment this line #add_definitions(-DUSE_OLD_DAG) From 8dbe26a95fe98142163f39243f01cdf3fb20c58a Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 10 Jun 2020 12:27:50 +0200 Subject: [PATCH 32/46] Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] --- src/Gui/CommandView.cpp | 6 ++- src/Gui/DlgExpressionInput.cpp | 3 +- src/Gui/DownloadItem.cpp | 3 +- src/Gui/FileDialog.cpp | 5 +- src/Gui/MainWindow.cpp | 5 +- src/Gui/ManualAlignment.cpp | 3 +- src/Gui/PythonConsole.cpp | 3 +- src/Gui/QuantitySpinBox.cpp | 5 +- src/Gui/ReportView.cpp | 3 +- src/Gui/SoTextLabel.cpp | 3 +- src/Gui/TextEdit.cpp | 5 +- src/Gui/Tools.h | 54 +++++++++++++++++++ src/Gui/ViewProviderAnnotation.cpp | 3 +- src/Gui/Widgets.cpp | 7 +-- src/Gui/iisTaskPanel/src/iisiconlabel.cpp | 4 ++ src/Mod/Part/Gui/TaskFaceColors.cpp | 3 +- .../PartDesign/Gui/TaskChamferParameters.cpp | 9 ++-- src/Mod/Sketcher/Gui/SoDatumLabel.cpp | 3 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 3 +- src/Mod/TechDraw/Gui/QGIView.cpp | 3 +- src/Mod/TechDraw/Gui/QGIViewBalloon.cpp | 3 +- 21 files changed, 107 insertions(+), 29 deletions(-) create mode 100644 src/Gui/Tools.h diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index b9327c41fb..47ead58c8d 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -70,6 +70,7 @@ #include "SceneInspector.h" #include "DemoMode.h" #include "TextureMapping.h" +#include "Tools.h" #include "Utilities.h" #include "NavigationStyle.h" @@ -1862,14 +1863,15 @@ void StdViewScreenShot::activated(int iMsg) QFont font = painter.font(); font.setPointSize(20); - int n = QFontMetrics(font).width(name); + QFontMetrics fm(font); + int n = QtTools::horizontalAdvance(fm, name); int h = pixmap.height(); painter.setFont(font); painter.drawText(8+appicon.width(), h-24, name); font.setPointSize(12); - int u = QFontMetrics(font).width(url); + int u = QtTools::horizontalAdvance(fm, url); painter.setFont(font); painter.drawText(8+appicon.width()+n-u, h-9, url); diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index 2c64c46e6b..6f7c299bc7 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -30,6 +30,7 @@ #include "DlgExpressionInput.h" #include "ui_DlgExpressionInput.h" #include "ExpressionCompleter.h" +#include "Tools.h" #include #include #include @@ -124,7 +125,7 @@ void DlgExpressionInput::textChanged(const QString &text) try { //resize the input field according to text size QFontMetrics fm(ui->expression->font()); - int width = fm.width(text) + 15; + int width = QtTools::horizontalAdvance(fm, text) + 15; if (width < minimumWidth) ui->expression->setMinimumWidth(minimumWidth); else diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index b882df8e81..04cbbaa350 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -53,6 +53,7 @@ #include "MainWindow.h" #include "FileDialog.h" #include "ui_DlgAuthorization.h" +#include "Tools.h" using namespace Gui::Dialog; @@ -100,7 +101,7 @@ SqueezeLabel::SqueezeLabel(QWidget *parent) : QLabel(parent) void SqueezeLabel::paintEvent(QPaintEvent *event) { QFontMetrics fm = fontMetrics(); - if (fm.width(text()) > contentsRect().width()) { + if (Gui::QtTools::horizontalAdvance(fm, text()) > contentsRect().width()) { QString elided = fm.elidedText(text(), Qt::ElideMiddle, width()); QString oldText = text(); setText(elided); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 7a982f4587..55377bdaad 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -45,6 +45,7 @@ #include "FileDialog.h" #include "MainWindow.h" #include "BitmapFactory.h" +#include "Tools.h" using namespace Gui; @@ -779,8 +780,8 @@ void FileChooser::setFilter ( const QString& filter ) void FileChooser::setButtonText( const QString& txt ) { button->setText( txt ); - int w1 = 2*button->fontMetrics().width(txt); - int w2 = 2*button->fontMetrics().width(QLatin1String(" ... ")); + int w1 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), txt); + int w2 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), QLatin1String(" ... ")); button->setFixedWidth( (w1 > w2 ? w1 : w2) ); } diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index bf89926d0b..d463acd077 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -116,6 +116,7 @@ #include "View3DInventor.h" #include "View3DInventorViewer.h" #include "DlgObjectSelection.h" +#include "Tools.h" FC_LOG_LEVEL_INIT("MainWindow",false,true,true) @@ -1547,14 +1548,14 @@ QPixmap MainWindow::splashImage() const QFont fontExe = painter.font(); fontExe.setPointSize(20); QFontMetrics metricExe(fontExe); - int l = metricExe.width(title); + int l = QtTools::horizontalAdvance(metricExe, title); int w = splash_image.width(); int h = splash_image.height(); QFont fontVer = painter.font(); fontVer.setPointSize(12); QFontMetrics metricVer(fontVer); - int v = metricVer.width(version); + int v = QtTools::horizontalAdvance(metricVer, version); int x = -1, y = -1; QRegExp rx(QLatin1String("(\\d+).(\\d+)")); diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 2deb44e8c3..d3e2c7aa73 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -67,6 +67,7 @@ #include "ManualAlignment.h" #include "BitmapFactory.h" #include "SoAxisCrossKit.h" +#include "Tools.h" using namespace Gui; @@ -472,7 +473,7 @@ public: QColor front; front.setRgbF(0.8f, 0.8f, 0.8f); - int w = fm.width(text); + int w = QtTools::horizontalAdvance(fm, text); int h = fm.height(); QImage image(w,h,QImage::Format_ARGB32_Premultiplied); diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index e866055a76..18794e028f 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -49,6 +49,7 @@ #include "DlgEditorImp.h" #include "FileDialog.h" #include "MainWindow.h" +#include "Tools.h" #include #include @@ -524,7 +525,7 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR QFont font(fontFamily, fontSize); setFont(font); QFontMetrics metric(font); - int width = metric.width(QLatin1String("0000")); + int width = QtTools::horizontalAdvance(metric, QLatin1String("0000")); setTabStopWidth(width); } else { QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 36a9e03da4..5708d4d0dd 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -41,6 +41,7 @@ #include "DlgExpressionInput.h" #include "propertyeditor/PropertyItem.h" #include "BitmapFactory.h" +#include "Tools.h" #include "Command.h" #include #include @@ -830,7 +831,7 @@ QSize QuantitySpinBox::sizeHint() const s = textFromValue(q); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, QtTools::horizontalAdvance(fm, s)); w += 2; // cursor blinking space w += iconHeight; @@ -860,7 +861,7 @@ QSize QuantitySpinBox::minimumSizeHint() const s = textFromValue(q); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, QtTools::horizontalAdvance(fm, s)); w += 2; // cursor blinking space w += iconHeight; diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index 207074f782..b9b4eaf23a 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -41,6 +41,7 @@ #include "BitmapFactory.h" #include "MainWindow.h" #include "Application.h" +#include "Tools.h" using namespace Gui; using namespace Gui::DockWnd; @@ -653,7 +654,7 @@ void ReportOutput::OnChange(Base::Subject &rCaller, const char * sR QFont font(fontFamily, fontSize); setFont(font); QFontMetrics metric(font); - int width = metric.width(QLatin1String("0000")); + int width = QtTools::horizontalAdvance(metric, QLatin1String("0000")); setTabStopWidth(width); } else if (strcmp(sReason, "RedirectPythonOutput") == 0) { diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index ca562d19d2..8d254342d3 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -65,6 +65,7 @@ #include "SoTextLabel.h" #include "SoFCInteractiveElement.h" #include "BitmapFactory.h" +#include "Tools.h" using namespace Gui; @@ -452,7 +453,7 @@ void SoFrameLabel::drawImage() QStringList lines; for (int i=0; i(w, fm.width(line)); + w = std::max(w, QtTools::horizontalAdvance(fm, line)); lines << line; } diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index f9f4cc7116..c890fdc252 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -32,6 +32,7 @@ #include "TextEdit.h" #include "SyntaxHighlighter.h" +#include "Tools.h" using namespace Gui; @@ -239,7 +240,7 @@ TextEditor::~TextEditor() int TextEditor::lineNumberAreaWidth() { - return fontMetrics().width(QLatin1String("0000"))+10; + return QtTools::horizontalAdvance(fontMetrics(), QLatin1String("0000")) + 10; } void TextEditor::updateLineNumberAreaWidth(int /* newBlockCount */) @@ -449,7 +450,7 @@ void TextEditor::OnChange(Base::Subject &rCaller,const char* sReaso if (strcmp(sReason, "TabSize") == 0 || strcmp(sReason, "FontSize") == 0) { int tabWidth = hPrefGrp->GetInt("TabSize", 4); QFontMetrics metric(font()); - int fontSize = metric.width(QLatin1String("0")); + int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0')); setTabStopWidth(tabWidth * fontSize); } diff --git a/src/Gui/Tools.h b/src/Gui/Tools.h new file mode 100644 index 0000000000..f09d11cbd3 --- /dev/null +++ b/src/Gui/Tools.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (c) 2020 Werner Mayer * + * * + * 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 GUI_TOOLS_H +#define GUI_TOOLS_H + +#include + +namespace Gui { + +/*! + * \brief The QtTools class + * Helper class to reduce adding a lot of extra QT_VERSION checks to client code. + */ +class GuiExport QtTools { +public: + static int horizontalAdvance(const QFontMetrics& fm, QChar ch) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + return fm.horizontalAdvance(ch); +#else + return fm.width(ch); +#endif + } + static int horizontalAdvance(const QFontMetrics& fm, const QString& text, int len = -1) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + return fm.horizontalAdvance(text, len); +#else + return fm.width(text, len); +#endif + } +}; + +} // namespace Gui + +#endif // GUI_TOOLS_H diff --git a/src/Gui/ViewProviderAnnotation.cpp b/src/Gui/ViewProviderAnnotation.cpp index 3c08140865..7859dc7c37 100644 --- a/src/Gui/ViewProviderAnnotation.cpp +++ b/src/Gui/ViewProviderAnnotation.cpp @@ -58,6 +58,7 @@ #include "Application.h" #include "Document.h" #include "Window.h" +#include "Tools.h" using namespace Gui; @@ -493,7 +494,7 @@ void ViewProviderAnnotationLabel::drawImage(const std::vector& s) QStringList lines; for (std::vector::const_iterator it = s.begin(); it != s.end(); ++it) { QString line = QString::fromUtf8(it->c_str()); - w = std::max(w, fm.width(line)); + w = std::max(w, QtTools::horizontalAdvance(fm, line)); lines << line; } diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 158766e2e3..83a24b9875 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -54,6 +54,7 @@ #include "BitmapFactory.h" #include "DlgExpressionInput.h" #include "QuantitySpinBox_p.h" +#include "Tools.h" using namespace Gui; using namespace App; @@ -1191,7 +1192,7 @@ int PropertyListEditor::lineNumberAreaWidth() ++digits; } - int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; + int space = 3 + QtTools::horizontalAdvance(fontMetrics(), QLatin1Char('9')) * digits; return space; } @@ -1398,8 +1399,8 @@ void LabelEditor::validateText(const QString& text) void LabelEditor::setButtonText(const QString& txt) { button->setText(txt); - int w1 = 2*button->fontMetrics().width(txt); - int w2 = 2*button->fontMetrics().width(QLatin1String(" ... ")); + int w1 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), txt); + int w2 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), QLatin1String(" ... ")); button->setFixedWidth((w1 > w2 ? w1 : w2)); } diff --git a/src/Gui/iisTaskPanel/src/iisiconlabel.cpp b/src/Gui/iisTaskPanel/src/iisiconlabel.cpp index f967eacc38..e80ec302f1 100644 --- a/src/Gui/iisTaskPanel/src/iisiconlabel.cpp +++ b/src/Gui/iisTaskPanel/src/iisiconlabel.cpp @@ -74,7 +74,11 @@ QSize iisIconLabel::minimumSizeHint() const int w = 8 + px.width(); if (!myText.isEmpty()) { QFontMetrics fm(myFont); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + w += fm.horizontalAdvance(myText); +#else w += fm.width(myText); +#endif h = qMax(h, 4+fm.height()); } diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 1549e3ba22..ffb9209a1a 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -408,7 +409,7 @@ void FaceColors::updatePanel() int maxWidth = d->ui->labelElement->width(); QFontMetrics fm(d->ui->labelElement->font()); - if (fm.width(faces) > maxWidth) { + if (Gui::QtTools::horizontalAdvance(fm, faces) > maxWidth) { faces = fm.elidedText(faces, Qt::ElideMiddle, maxWidth); } diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index f36cec8fa3..51413f3185 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -131,10 +132,10 @@ void TaskChamferParameters::setUpUI(PartDesign::Chamfer* pcChamfer) ui->stackedWidget->setFixedHeight(ui->chamferSize2->sizeHint().height()); QFontMetrics fm(ui->typeLabel->font()); - int minWidth = fm.width(ui->typeLabel->text()); - minWidth = std::max(minWidth, fm.width(ui->sizeLabel->text())); - minWidth = std::max(minWidth, fm.width(ui->size2Label->text())); - minWidth = std::max(minWidth, fm.width(ui->angleLabel->text())); + int minWidth = Gui::QtTools::horizontalAdvance(fm, ui->typeLabel->text()); + minWidth = std::max(minWidth, Gui::QtTools::horizontalAdvance(fm, ui->sizeLabel->text())); + minWidth = std::max(minWidth, Gui::QtTools::horizontalAdvance(fm, ui->size2Label->text())); + minWidth = std::max(minWidth, Gui::QtTools::horizontalAdvance(fm, ui->angleLabel->text())); minWidth = minWidth + 5; //spacing ui->typeLabel->setMinimumWidth(minWidth); ui->sizeLabel->setMinimumWidth(minWidth); diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp index 76af0787e0..9d416f336a 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp @@ -56,6 +56,7 @@ #include "SoDatumLabel.h" #include +#include #define ZCONSTR 0.006f @@ -116,7 +117,7 @@ void SoDatumLabel::drawImage() QFontMetrics fm(font); QString str = QString::fromUtf8(s[0].getString()); - int w = fm.width(str); + int w = Gui::QtTools::horizontalAdvance(fm, str); int h = fm.height(); // No Valid text diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index dccd9f0f04..b76d21e619 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -94,6 +94,7 @@ #include #include #include +#include #include #include #include @@ -3471,7 +3472,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type, boundingBoxes->push_back(labelBB); } - cursorOffset += qfm.width(labelStr); + cursorOffset += Gui::QtTools::horizontalAdvance(qfm, labelStr); } } diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp index d2fbe33a15..056ddf7953 100644 --- a/src/Mod/TechDraw/Gui/QGIView.cpp +++ b/src/Mod/TechDraw/Gui/QGIView.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include "Rez.h" @@ -719,7 +720,7 @@ int QGIView::calculateFontPixelSize(double sizeInMillimetres) int QGIView::calculateFontPixelWidth(const QFont &font) { // Return the width of digit 0, most likely the most wide digit - return QFontMetrics(font).width(QChar::fromLatin1('0')); + return Gui::QtTools::horizontalAdvance(QFontMetrics(font), QChar::fromLatin1('0')); } const double QGIView::DefaultFontSizeInMM = 5.0; diff --git a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp index d14fe4ad35..d18fb5b827 100644 --- a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -444,7 +445,7 @@ void QGIViewBalloon::updateBalloon(bool obtuse) int pos = labelText.indexOf(QString::fromUtf8("|")); labelText.replace(pos, 1, QString::fromUtf8(" ")); QFontMetrics fm(balloonLabel->getFont()); - balloonLabel->seps.push_back(fm.width((labelText.left(pos + 2)))); + balloonLabel->seps.push_back(Gui::QtTools::horizontalAdvance(fm, labelText.left(pos + 2))); balloonLabel->verticalSep = true; } } From c8dae9eb85a4b12cd35dcd2a4a6adfe973a924fc Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 10 Jun 2020 23:02:47 +0200 Subject: [PATCH 33/46] Qt5: 'void QTime::start()' / 'int QTime::elapsed() const' / 'int QTime::restart()' are deprecated: Use QElapsedTimer instead [-Wdeprecated-declarations] --- src/Base/PreCompiled.h | 2 ++ src/Base/Tools.cpp | 7 ++----- src/Gui/DownloadItem.cpp | 7 +++++-- src/Gui/DownloadItem.h | 5 +++-- src/Gui/ProgressBar.cpp | 7 ++++--- src/Gui/ProgressDialog.cpp | 7 ++++--- src/Gui/SoFCColorBar.cpp | 5 ++++- src/Gui/SoFCColorBar.h | 4 ++-- src/Gui/Tree.h | 4 ++-- src/Gui/Widgets.cpp | 1 + src/Gui/Widgets.h | 4 ++-- src/Mod/Mesh/Gui/RemeshGmsh.cpp | 4 ++-- src/Mod/Part/Gui/TaskCheckGeometry.h | 4 ++-- 13 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/Base/PreCompiled.h b/src/Base/PreCompiled.h index 2503d7e86d..8de6fe3b9c 100644 --- a/src/Base/PreCompiled.h +++ b/src/Base/PreCompiled.h @@ -114,11 +114,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include diff --git a/src/Base/Tools.cpp b/src/Base/Tools.cpp index 167b9bed36..d5b32e03dd 100644 --- a/src/Base/Tools.cpp +++ b/src/Base/Tools.cpp @@ -26,9 +26,9 @@ # include # include # include +# include #endif -# include #include "PyExport.h" #include "Interpreter.h" #include "Tools.h" @@ -265,7 +265,7 @@ using namespace Base; struct StopWatch::Private { - QTime t; + QElapsedTimer t; }; StopWatch::StopWatch() : d(new Private) @@ -313,6 +313,3 @@ std::string StopWatch::toString(int ms) const str << msec << "ms"; return str.str(); } - - - diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 04cbbaa350..00edad31d8 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -130,7 +130,9 @@ AutoSaver::~AutoSaver() void AutoSaver::changeOccurred() { - if (m_firstChange.isNull()) +if (!m_firstChange.isValid()) +printf("changeOccurred\n"); + if (!m_firstChange.isValid()) m_firstChange.start(); if (m_firstChange.elapsed() > MAXWAIT) { @@ -154,7 +156,8 @@ void AutoSaver::saveIfNecessary() if (!m_timer.isActive()) return; m_timer.stop(); - m_firstChange = QTime(); +printf("saveifnecessary\n"); + m_firstChange = QElapsedTimer(); if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) { qWarning() << "AutoSaver: error invoking slot save() on parent"; } diff --git a/src/Gui/DownloadItem.h b/src/Gui/DownloadItem.h index b032a832fb..51fc3f8882 100644 --- a/src/Gui/DownloadItem.h +++ b/src/Gui/DownloadItem.h @@ -25,6 +25,7 @@ #define GUI_DIALOG_DOWNLOADITEM_H #include +#include #include #include #include @@ -83,7 +84,7 @@ protected: private: QBasicTimer m_timer; - QTime m_firstChange; + QElapsedTimer m_firstChange; }; @@ -146,7 +147,7 @@ private: bool m_requestFileName; qint64 m_bytesReceived; - QTime m_downloadTime; + QElapsedTimer m_downloadTime; }; } // namespace Dialog diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index bf65b37e0b..47f22faf32 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include # include # include @@ -51,9 +52,9 @@ struct SequencerBarPrivate { ProgressBar* bar; WaitCursor* waitCursor; - QTime measureTime; - QTime progressTime; - QTime checkAbortTime; + QElapsedTimer measureTime; + QElapsedTimer progressTime; + QElapsedTimer checkAbortTime; QString text; bool guiThread; }; diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp index da83fd5044..cf803daf6b 100644 --- a/src/Gui/ProgressDialog.cpp +++ b/src/Gui/ProgressDialog.cpp @@ -26,8 +26,9 @@ # include # include # include -# include +# include # include +# include #endif #include "ProgressDialog.h" #include "MainWindow.h" @@ -40,8 +41,8 @@ namespace Gui { struct SequencerDialogPrivate { ProgressDialog* dlg; - QTime measureTime; - QTime progressTime; + QElapsedTimer measureTime; + QElapsedTimer progressTime; QString text; bool guiThread; bool canabort; diff --git a/src/Gui/SoFCColorBar.cpp b/src/Gui/SoFCColorBar.cpp index 7145d1d944..614841728d 100644 --- a/src/Gui/SoFCColorBar.cpp +++ b/src/Gui/SoFCColorBar.cpp @@ -254,7 +254,10 @@ void SoFCColorBar::handleEvent (SoHandleEventAction *action) if ((e->getButton() == SoMouseButtonEvent::BUTTON1)) { if (e->getState() == SoButtonEvent::DOWN) { // double click event - if (_timer.restart() < QApplication::doubleClickInterval()) { + if (!_timer.isValid()) { + _timer.start(); + } + else if (_timer.restart() < QApplication::doubleClickInterval()) { QApplication::postEvent( new SoFCColorBarProxyObject(this), new QEvent(QEvent::User)); diff --git a/src/Gui/SoFCColorBar.h b/src/Gui/SoFCColorBar.h index 389e16b4f2..c02e3cf891 100644 --- a/src/Gui/SoFCColorBar.h +++ b/src/Gui/SoFCColorBar.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -190,7 +190,7 @@ private: private: float _fMaxX, _fMinX, _fMaxY, _fMinY; - QTime _timer; + QElapsedTimer _timer; SoSwitch* pColorMode; std::vector _colorBars; diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index 4da8e8f62e..caed51169f 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -228,7 +228,7 @@ private: QTimer* statusTimer; QTimer* selectTimer; QTimer* preselectTimer; - QTime preselectTime; + QElapsedTimer preselectTime; static std::unique_ptr documentPixmap; static std::unique_ptr documentPartialPixmap; std::unordered_map DocumentMap; diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 83a24b9875..6651742922 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -990,6 +990,7 @@ void ToolTip::showText(const QPoint & pos, const QString & text, QWidget * w) tip->w = w; // show text with a short delay tip->tooltipTimer.start(80, tip); + tip->displayTime.start(); } else { // do immediately diff --git a/src/Gui/Widgets.h b/src/Gui/Widgets.h index 0fd06bb59c..c2aed4189f 100644 --- a/src/Gui/Widgets.h +++ b/src/Gui/Widgets.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include "ExpressionBinding.h" @@ -351,7 +351,7 @@ private: QPoint pos; QPointer w; // need guard in case widget gets destroyed QBasicTimer tooltipTimer; - QTime displayTime; + QElapsedTimer displayTime; }; // ---------------------------------------------------------------------- diff --git a/src/Mod/Mesh/Gui/RemeshGmsh.cpp b/src/Mod/Mesh/Gui/RemeshGmsh.cpp index 9651aac101..dd5dc0a4dd 100644 --- a/src/Mod/Mesh/Gui/RemeshGmsh.cpp +++ b/src/Mod/Mesh/Gui/RemeshGmsh.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include #endif #include "RemeshGmsh.h" @@ -69,7 +69,7 @@ public: QPointer label; QPointer syntax; QProcess gmsh; - QTime time; + QElapsedTimer time; }; GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl) diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.h b/src/Mod/Part/Gui/TaskCheckGeometry.h index 9c4349a179..b45e7b1005 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.h +++ b/src/Mod/Part/Gui/TaskCheckGeometry.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include class SoSeparator; class SoSwitch; @@ -200,7 +200,7 @@ public: private: int steps; bool canceled; - QTime time; + QElapsedTimer time; QProgressDialog* myProgress; }; From ed8a5f2ba7eac05c4431ab0e8e6c29db65d07151 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 10 Jun 2020 23:30:03 +0200 Subject: [PATCH 34/46] Qt5: 'QModelIndex QModelIndex::child(int, int) const' is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] --- src/Gui/Tree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 88e2c8b672..c9ad1c876b 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1269,14 +1269,14 @@ void TreeWidget::keyPressEvent(QKeyEvent *event) }else if(event->key() == Qt::Key_Left) { auto index = currentIndex(); if(index.column()==1) { - setCurrentIndex(index.parent().child(index.row(),0)); + setCurrentIndex(model()->index(index.row(), 0, index.parent())); event->accept(); return; } }else if(event->key() == Qt::Key_Right) { auto index = currentIndex(); if(index.column()==0) { - setCurrentIndex(index.parent().child(index.row(),1)); + setCurrentIndex(model()->index(index.row(), 1, index.parent())); event->accept(); return; } From cff0638672e63720c828245aab45c1799a21e7da Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 02:21:57 +0200 Subject: [PATCH 35/46] Qt5: QDesktopWidget is deprecated use QScreen [-Wdeprecated-declarations] --- src/Gui/Action.cpp | 8 ++++++++ src/Gui/DlgPreferencesImp.cpp | 8 ++++++++ src/Gui/MainWindow.cpp | 8 ++++++++ src/Gui/Splashscreen.cpp | 8 ++++++++ src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp | 8 ++++++++ src/Mod/Web/Gui/BrowserView.cpp | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index a75bf5df68..5d0ea6a90f 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -37,6 +37,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include "Action.h" #include "Application.h" @@ -420,7 +424,11 @@ void WorkbenchComboBox::showPopup() int rows = count(); if (rows > 0) { int height = view()->sizeHintForRow(0); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + int maxHeight = QApplication::primaryScreen()->size().height(); +#else int maxHeight = QApplication::desktop()->height(); +#endif view()->setMinimumHeight(qMin(height * rows, maxHeight/2)); } diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/DlgPreferencesImp.cpp index 260ed4132e..f327cd7740 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/DlgPreferencesImp.cpp @@ -34,6 +34,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include @@ -307,7 +311,11 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev) if (canEmbedScrollArea) { // embed the widget stack into a scroll area if the size is // bigger than the available desktop +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif int maxHeight = rect.height() - 60; int maxWidth = rect.width(); if (height() > maxHeight || width() > maxWidth) { diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index d463acd077..458993b560 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -53,6 +53,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + // FreeCAD Base header #include #include @@ -1409,7 +1413,11 @@ void MainWindow::loadWindowSettings() QString qtver = QString::fromLatin1("Qt%1.%2").arg(major).arg(minor); QSettings config(vendor, application); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif int maxHeight = rect.height(); int maxWidth = rect.width(); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index d3e04ba27b..66efe4df49 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -44,6 +44,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include @@ -234,7 +238,11 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) setModal(true); ui->setupUi(this); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif QPixmap image = getMainWindow()->splashImage(); // Make sure the image is not too big diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp index 584f0ce2a8..0d2db3db0b 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp @@ -64,6 +64,10 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include "qtcolorpicker.h" /*! \class QtColorPicker @@ -312,7 +316,11 @@ void QtColorPicker::buttonPressed(bool toggled) if (!toggled) return; +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + const QRect desktop = QApplication::primaryScreen()->geometry(); +#else const QRect desktop = QApplication::desktop()->geometry(); +#endif // Make sure the popup is inside the desktop. QPoint pos = mapToGlobal(rect().bottomLeft()); if (pos.x() < desktop.left()) diff --git a/src/Mod/Web/Gui/BrowserView.cpp b/src/Mod/Web/Gui/BrowserView.cpp index fc7c860336..e649f799ec 100644 --- a/src/Mod/Web/Gui/BrowserView.cpp +++ b/src/Mod/Web/Gui/BrowserView.cpp @@ -71,6 +71,10 @@ # define QWEBPAGE QWebPage #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include "BrowserView.h" @@ -239,7 +243,11 @@ WebView::WebView(QWidget *parent) : QWEBVIEW(parent) { // Increase html font size for high DPI displays +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect mainScreenSize = QApplication::primaryScreen()->geometry(); +#else QRect mainScreenSize = QApplication::desktop()->screenGeometry(); +#endif if (mainScreenSize.width() > 1920){ setTextSizeMultiplier (mainScreenSize.width()/1920.0); } From d456b1021eabd0183bf42a92aebe0e65a550905b Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 18:25:21 +0200 Subject: [PATCH 36/46] Qt5: 'QVariant qVariantFromValue(const T&)' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] --- src/Gui/CallTips.cpp | 2 +- src/Mod/TechDraw/App/QDomNodeModel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index a7cf430099..d6e71d96fa 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -523,7 +523,7 @@ void CallTipsList::showTips(const QString& line) addItem(it.key()); QListWidgetItem *item = this->item(this->count()-1); item->setData(Qt::ToolTipRole, QVariant(it.value().description)); - item->setData(Qt::UserRole, qVariantFromValue( it.value() )); //< store full CallTip data + item->setData(Qt::UserRole, QVariant::fromValue( it.value() )); //< store full CallTip data switch (it.value().type) { case CallTip::Module: diff --git a/src/Mod/TechDraw/App/QDomNodeModel.cpp b/src/Mod/TechDraw/App/QDomNodeModel.cpp index 7e3f890522..1ecfa48d04 100644 --- a/src/Mod/TechDraw/App/QDomNodeModel.cpp +++ b/src/Mod/TechDraw/App/QDomNodeModel.cpp @@ -273,7 +273,7 @@ QString QDomNodeModel::stringValue ( const QXmlNodeModelIndex & ni ) const QVariant QDomNodeModel::typedValue ( const QXmlNodeModelIndex & ni ) const { - return qVariantFromValue(stringValue(ni)); + return QVariant::fromValue(stringValue(ni)); } QXmlNodeModelIndex QDomNodeModel::fromDomNode(const QDomNode &n) const From 264174680809d0a10c8b889aa2b0081ad41332b0 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 18:38:24 +0200 Subject: [PATCH 37/46] Qt5: 'void QFileDialog::setConfirmOverwrite(bool)' is deprecated: Use setOption(DontConfirmOverwrite, not enabled) instead [-Wdeprecated-declarations] --- src/Gui/CommandView.cpp | 2 +- src/Gui/FileDialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 47ead58c8d..9585fafe52 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1785,7 +1785,7 @@ void StdViewScreenShot::activated(int iMsg) opt->setMethod(method); fd.setOptionsWidget(FileOptionsDialog::ExtensionRight, opt); - fd.setConfirmOverwrite(true); + fd.setOption(QFileDialog::DontConfirmOverwrite, false); opt->onSelectedFilter(fd.selectedNameFilter()); QObject::connect(&fd, SIGNAL(filterSelected(const QString&)), opt, SLOT(onSelectedFilter(const QString&))); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 55377bdaad..abdda90cc5 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -204,7 +204,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, dlg.selectNameFilter(*selectedFilter); dlg.onSelectedFilter(dlg.selectedNameFilter()); dlg.setNameFilterDetailsVisible(true); - dlg.setConfirmOverwrite(true); + dlg.setOption(QFileDialog::DontConfirmOverwrite, false); if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dlg.selectedNameFilter(); From e00ff1d78d8cdbcf61fbaf8d7d4efac03c936622 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 18:42:21 +0200 Subject: [PATCH 38/46] Qt5: 'void QFileDialog::setNameFilterDetailsVisible(bool)' is deprecated: Use setOption(HideNameFilterDetails, not enabled) instead [-Wdeprecated-declarations] --- src/Gui/FileDialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index abdda90cc5..9e5261299b 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -203,7 +203,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, if (selectedFilter && !selectedFilter->isEmpty()) dlg.selectNameFilter(*selectedFilter); dlg.onSelectedFilter(dlg.selectedNameFilter()); - dlg.setNameFilterDetailsVisible(true); + dlg.setOption(QFileDialog::HideNameFilterDetails, false); dlg.setOption(QFileDialog::DontConfirmOverwrite, false); if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) @@ -297,7 +297,7 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c dlg.setDirectory(dirName); dlg.setOptions(options); dlg.setNameFilters(filter.split(QLatin1String(";;"))); - dlg.setNameFilterDetailsVisible(true); + dlg.setOption(QFileDialog::HideNameFilterDetails, false); if (selectedFilter && !selectedFilter->isEmpty()) dlg.selectNameFilter(*selectedFilter); if (dlg.exec() == QDialog::Accepted) { @@ -373,7 +373,7 @@ QStringList FileDialog::getOpenFileNames (QWidget * parent, const QString & capt dlg.setDirectory(dirName); dlg.setOptions(options); dlg.setNameFilters(filter.split(QLatin1String(";;"))); - dlg.setNameFilterDetailsVisible(true); + dlg.setOption(QFileDialog::HideNameFilterDetails, false); if (selectedFilter && !selectedFilter->isEmpty()) dlg.selectNameFilter(*selectedFilter); if (dlg.exec() == QDialog::Accepted) { From 98b1116424da972e18134bfcc9c21ed64714c07d Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 22:21:21 +0200 Subject: [PATCH 39/46] Qt5: QDialog extension/orientation is deprecated [-Wdeprecated-declarations] --- src/Gui/FileDialog.cpp | 59 +++++++++++++++++++++++++++++++++++------- src/Gui/FileDialog.h | 4 +++ 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 9e5261299b..4940447a84 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -28,6 +28,7 @@ # include # include # include +# include # include # include # include @@ -463,6 +464,7 @@ void FileDialog::saveLocation(const QString& dirName) FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl ) : QFileDialog( parent, fl ) + , extensionPos(ExtensionRight) { extensionButton = new QPushButton( this ); extensionButton->setText( tr( "Extended" ) ); @@ -471,6 +473,10 @@ FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl ) setOption(QFileDialog::DontUseNativeDialog); #endif + // This is an alternative to add the button to the grid layout + //QDialogButtonBox* box = this->findChild(); + //box->addButton(extensionButton, QDialogButtonBox::ActionRole); + //search for the grid layout and add the new button QGridLayout* grid = this->findChild(); #if QT_VERSION >= 0x040500 @@ -546,22 +552,55 @@ void FileOptionsDialog::accept() void FileOptionsDialog::toggleExtension() { - QWidget* w = extension(); - if (w) - showExtension(!w->isVisible()); + if (extensionWidget) { + bool showIt = !extensionWidget->isVisible(); + if (showIt) { + oldSize = size(); + QSize s(extensionWidget->sizeHint() + .expandedTo(extensionWidget->minimumSize()) + .boundedTo(extensionWidget->maximumSize())); + if (extensionPos == ExtensionRight) { + setFixedSize(width() + s.width(), height()); + } + else { + setFixedSize(width(), height() + s.height()); + } + + extensionWidget->show(); + } + else { + extensionWidget->hide(); + setFixedSize(oldSize); + } + } } void FileOptionsDialog::setOptionsWidget(FileOptionsDialog::ExtensionPosition pos, QWidget* w, bool show) { - if (pos == ExtensionRight) { - setExtension(w); - setOrientation(Qt::Horizontal); + extensionPos = pos; + extensionWidget = w; + if (extensionWidget->parentWidget() != this) + extensionWidget->setParent(this); + + QGridLayout* grid = this->findChild(); + + if (extensionPos == ExtensionRight) { + int cols = grid->columnCount(); + grid->addWidget(extensionWidget, 0, cols, -1, -1); + setMinimumHeight(extensionWidget->height()); } - else if (pos == ExtensionBottom) { - setExtension(w); - setOrientation(Qt::Vertical); + else if (extensionPos == ExtensionBottom) { + int rows = grid->rowCount(); + grid->addWidget(extensionWidget, rows, 0, -1, -1); + setMinimumWidth(extensionWidget->width()); } + // Instead of resizing the dialog we can fix the layout size. + // This however, doesn't work nicely when the extension widget + // is higher/wider than the dialog. + //grid->setSizeConstraint(QLayout::SetFixedSize); + + oldSize = size(); w->hide(); if (show) toggleExtension(); @@ -569,7 +608,7 @@ void FileOptionsDialog::setOptionsWidget(FileOptionsDialog::ExtensionPosition po QWidget* FileOptionsDialog::getOptionsWidget() const { - return this->extension(); + return extensionWidget; } // ====================================================================== diff --git a/src/Gui/FileDialog.h b/src/Gui/FileDialog.h index a9602e06b2..61dd6ecf2c 100644 --- a/src/Gui/FileDialog.h +++ b/src/Gui/FileDialog.h @@ -28,6 +28,7 @@ #include #include #include +#include class QButtonGroup; class QGridLayout; @@ -105,7 +106,10 @@ protected Q_SLOTS: void toggleExtension(); private: + QSize oldSize; + ExtensionPosition extensionPos; QPushButton* extensionButton; + QPointer extensionWidget; }; // ---------------------------------------------------------------------- From aefd5e235834c1bebb84b1108808da335859fc84 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 22:37:39 +0200 Subject: [PATCH 40/46] Qt5: 'void Q[Plain]TextEdit::setTabStopWidth(int)' is deprecated [-Wdeprecated-declarations] --- src/Gui/PythonConsole.cpp | 4 ++++ src/Gui/ReportView.cpp | 4 ++++ src/Gui/TextEdit.cpp | 4 ++++ src/Mod/TechDraw/Gui/mrichtextedit.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 18794e028f..9eb42fb69c 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -526,7 +526,11 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR setFont(font); QFontMetrics metric(font); int width = QtTools::horizontalAdvance(metric, QLatin1String("0000")); +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) setTabStopWidth(width); +#else + setTabStopDistance(width); +#endif } else { QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); if (it != d->colormap.end()) { diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index b9b4eaf23a..e290178dc5 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -655,7 +655,11 @@ void ReportOutput::OnChange(Base::Subject &rCaller, const char * sR setFont(font); QFontMetrics metric(font); int width = QtTools::horizontalAdvance(metric, QLatin1String("0000")); +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) setTabStopWidth(width); +#else + setTabStopDistance(width); +#endif } else if (strcmp(sReason, "RedirectPythonOutput") == 0) { bool checked = rclGrp.GetBool(sReason, true); diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index c890fdc252..8be98a1472 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -451,7 +451,11 @@ void TextEditor::OnChange(Base::Subject &rCaller,const char* sReaso int tabWidth = hPrefGrp->GetInt("TabSize", 4); QFontMetrics metric(font()); int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0')); +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) setTabStopWidth(tabWidth * fontSize); +#else + setTabStopDistance(tabWidth * fontSize); +#endif } // Enables/Disables Line number in the Macro Editor from Edit->Preferences->Editor menu. diff --git a/src/Mod/TechDraw/Gui/mrichtextedit.cpp b/src/Mod/TechDraw/Gui/mrichtextedit.cpp index 39d339d379..9ea19fc268 100644 --- a/src/Mod/TechDraw/Gui/mrichtextedit.cpp +++ b/src/Mod/TechDraw/Gui/mrichtextedit.cpp @@ -63,7 +63,11 @@ using namespace TechDraw; MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent) { setupUi(this); m_lastBlockList = 0; +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) f_textedit->setTabStopWidth(40); +#else + f_textedit->setTabStopDistance(40); +#endif // setDefFontSize(getDefFontSizeNum()); setDefFontSize(TechDrawGui::PreferencesGui::labelFontSizePX()); m_defFont = getDefFont().family(); From a455927d4a163de62fceb4600a5403c027f74144 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 23:09:13 +0200 Subject: [PATCH 41/46] Qt5: Replace deprecated functions of QString: 'QString& QString::vsprintf(const char*, __va_list_tag*)' is deprecated: Use vasprintf(), arg() or QTextStream instead [-Wdeprecated-declarations] 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations] --- src/Gui/Command.cpp | 4 ++++ src/Mod/TechDraw/Gui/QGVPage.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index c6c139757d..32720506d7 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -624,7 +624,11 @@ void Command::_doCommand(const char *file, int line, DoCmd_Type eType, const cha va_list ap; va_start(ap, sCmd); QString s; +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) const QString cmd = s.vsprintf(sCmd, ap); +#else + const QString cmd = s.vasprintf(sCmd, ap); +#endif va_end(ap); // 'vsprintf' expects a utf-8 string for '%s' diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index 15fe50760d..822a81230e 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -923,8 +923,13 @@ void QGVPage::postProcessXml(QTemporaryFile& temporaryFile, QString fileName, QS QString::fromUtf8("stroke: none;")); // Scale the template group correctly +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) templateGroup.setAttribute(QString::fromUtf8("transform"), QString().sprintf("scale(%f, %f)", Rez::guiX(1.0), Rez::guiX(1.0))); +#else + templateGroup.setAttribute(QString::fromUtf8("transform"), + QString::fromLatin1("scale(%1, %2)").arg(Rez::guiX(1.0), 0, 'f').arg(Rez::guiX(1.0), 0, 'f')); +#endif // Finally, transfer all template document child nodes under the template group while (!templateDocElem.firstChild().isNull()) { From 8b5e05d1dca66bc91a7500670686ba27200ff8d4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 23:54:46 +0200 Subject: [PATCH 42/46] Fix -Wdeprecated-copy --- src/Mod/Mesh/App/Core/Elements.cpp | 11 +++++++++++ src/Mod/Mesh/App/Core/Elements.h | 4 ++++ src/Mod/Mesh/App/Core/KDTree.cpp | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/src/Mod/Mesh/App/Core/Elements.cpp b/src/Mod/Mesh/App/Core/Elements.cpp index 3bd4a14f5a..23e9ef6f2d 100644 --- a/src/Mod/Mesh/App/Core/Elements.cpp +++ b/src/Mod/Mesh/App/Core/Elements.cpp @@ -39,6 +39,11 @@ using namespace MeshCore; using namespace Wm4; +MeshPointArray::MeshPointArray(const MeshPointArray& ary) + : TMeshPointArray(ary) +{ +} + unsigned long MeshPointArray::Get (const MeshPoint &rclPoint) { iterator clIter; @@ -97,6 +102,12 @@ void MeshPointArray::Transform(const Base::Matrix4D& mat) mat.multVec(*pP,*pP); } +MeshFacetArray::MeshFacetArray(const MeshFacetArray& ary) + : TMeshFacetArray(ary) +{ +} + + void MeshFacetArray::Erase (_TIterator pIter) { unsigned long i, *pulN; diff --git a/src/Mod/Mesh/App/Core/Elements.h b/src/Mod/Mesh/App/Core/Elements.h index 83bf821ef5..70a8469272 100644 --- a/src/Mod/Mesh/App/Core/Elements.h +++ b/src/Mod/Mesh/App/Core/Elements.h @@ -548,6 +548,8 @@ public: MeshPointArray (void) { } // constructor MeshPointArray (unsigned long ulSize) : TMeshPointArray(ulSize) { } + /// copy-constructor + MeshPointArray (const MeshPointArray&); // Destructor ~MeshPointArray (void) { } //@} @@ -600,6 +602,8 @@ public: MeshFacetArray (void) { } /// constructor MeshFacetArray (unsigned long ulSize) : TMeshFacetArray(ulSize) { } + /// copy-constructor + MeshFacetArray (const MeshFacetArray&); /// destructor ~MeshFacetArray (void) { } //@} diff --git a/src/Mod/Mesh/App/Core/KDTree.cpp b/src/Mod/Mesh/App/Core/KDTree.cpp index c7a7f72377..adf5b39dcd 100644 --- a/src/Mod/Mesh/App/Core/KDTree.cpp +++ b/src/Mod/Mesh/App/Core/KDTree.cpp @@ -41,6 +41,14 @@ struct Point3d { } + Point3d(const Point3d& pnt) : p(pnt.p), i(pnt.i) + { + } + + ~Point3d() + { + } + inline value_type operator[](const int N) const { return p[N]; From 29fb43110b537e2268fface1ab53c6ae9a9e641b Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 01:27:32 +0200 Subject: [PATCH 43/46] replace use of deprecated function ftime with gettimeofday --- src/Base/TimeInfo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Base/TimeInfo.cpp b/src/Base/TimeInfo.cpp index 63420011c5..88c5520a08 100644 --- a/src/Base/TimeInfo.cpp +++ b/src/Base/TimeInfo.cpp @@ -26,6 +26,9 @@ #ifndef _PreComp_ # include # include +# if defined(FC_OS_LINUX) +# include +# endif #endif #include "TimeInfo.h" @@ -57,7 +60,7 @@ TimeInfo::~TimeInfo() void TimeInfo::setCurrent(void) { -#if defined (FC_OS_BSD) +#if defined (FC_OS_BSD) || defined(FC_OS_LINUX) struct timeval t; gettimeofday(&t, NULL); timebuffer.time = t.tv_sec; @@ -65,7 +68,7 @@ void TimeInfo::setCurrent(void) #elif defined(FC_OS_WIN32) _ftime(&timebuffer); #else - ftime(&timebuffer); + ftime(&timebuffer); // deprecated #endif } From 2571b8591c845b4dc663ea86b0cc62037b9b1bba Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 01:40:20 +0200 Subject: [PATCH 44/46] cast between incompatible function types from 'PyObject* (*)(PyObject*, PyObject*, PyObject*)' {aka '_object* (*)(_object*, _object*, _object*)'} to 'PyCFunction' {aka '_object* (*)(_object*, _object*)'} [-Wcast-function-type] --- src/App/ApplicationPy.cpp | 6 +++--- src/Gui/Selection.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/App/ApplicationPy.cpp b/src/App/ApplicationPy.cpp index e4acb4d607..8373b18f34 100644 --- a/src/App/ApplicationPy.cpp +++ b/src/App/ApplicationPy.cpp @@ -106,9 +106,9 @@ PyMethodDef Application::Methods[] = { "* If no module is given it will be determined by the file extension.\n" "* If more than one module can load a file the first one one will be taken.\n" "* If no module exists to load the file an exception will be raised."}, - {"open", (PyCFunction) Application::sOpenDocument, METH_VARARGS|METH_KEYWORDS, + {"open", reinterpret_cast(reinterpret_cast( Application::sOpenDocument )), METH_VARARGS|METH_KEYWORDS, "See openDocument(string)"}, - {"openDocument", (PyCFunction) Application::sOpenDocument, METH_VARARGS|METH_KEYWORDS, + {"openDocument", reinterpret_cast(reinterpret_cast( Application::sOpenDocument )), METH_VARARGS|METH_KEYWORDS, "openDocument(filepath,hidden=False) -> object\n" "Create a document and load the project file into the document.\n\n" "filepath: file path to an existing file. If the file doesn't exist\n" @@ -118,7 +118,7 @@ PyMethodDef Application::Methods[] = { // {"saveDocument", (PyCFunction) Application::sSaveDocument, METH_VARARGS, // "saveDocument(string) -- Save the document to a file."}, // {"saveDocumentAs", (PyCFunction) Application::sSaveDocumentAs, METH_VARARGS}, - {"newDocument", (PyCFunction) Application::sNewDocument, METH_VARARGS|METH_KEYWORDS, + {"newDocument", reinterpret_cast(reinterpret_cast( Application::sNewDocument )), METH_VARARGS|METH_KEYWORDS, "newDocument(name, label=None, hidden=False) -> object\n" "Create a new document with a given name.\n\n" "name: unique document name which is checked automatically.\n" diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index df7e42f2a8..8a244eab52 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -1809,7 +1809,7 @@ PyMethodDef SelectionSingleton::Methods[] = { "given the complete selection is cleared."}, {"isSelected", (PyCFunction) SelectionSingleton::sIsSelected, METH_VARARGS, "isSelected(object,resolve=True) -- Check if a given object is selected"}, - {"setPreselection", (PyCFunction) SelectionSingleton::sSetPreselection, METH_VARARGS|METH_KEYWORDS, + {"setPreselection", reinterpret_cast(reinterpret_cast( SelectionSingleton::sSetPreselection )), METH_VARARGS|METH_KEYWORDS, "setPreselection() -- Set preselected object"}, {"getPreselection", (PyCFunction) SelectionSingleton::sGetPreselection, METH_VARARGS, "getPreselection() -- Get preselected object"}, From 47b862bbd9099964f90a387a586da052a7caddce Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 15:10:15 +0200 Subject: [PATCH 45/46] boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated --- src/Mod/ReverseEngineering/App/PreCompiled.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Mod/ReverseEngineering/App/PreCompiled.h b/src/Mod/ReverseEngineering/App/PreCompiled.h index 12bb5e405f..e338d89b3b 100644 --- a/src/Mod/ReverseEngineering/App/PreCompiled.h +++ b/src/Mod/ReverseEngineering/App/PreCompiled.h @@ -47,6 +47,11 @@ # pragma warning(disable : 4522) #endif +// pcl headers include instead of +#ifndef BOOST_BIND_GLOBAL_PLACEHOLDERS +#define BOOST_BIND_GLOBAL_PLACEHOLDERS +#endif + #ifdef _PreComp_ // standard From 2799f553a1fd4a4d40c7c799be3df048299beb94 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 16:02:13 +0200 Subject: [PATCH 46/46] Py2: fix Python 2 build failure --- src/Mod/Part/App/AppPartPy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index b4143b1520..aa407ac12a 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1841,11 +1841,19 @@ private: if (!p) { throw Py::TypeError("** makeWireString can't convert PyString."); } +#if PY_VERSION_HEX >= 0x03030000 pysize = PyUnicode_GetLength(p); +#else + pysize = PyUnicode_GetSize(p); +#endif unichars = PyUnicode_AS_UNICODE(p); } else if (PyUnicode_Check(intext)) { +#if PY_VERSION_HEX >= 0x03030000 pysize = PyUnicode_GetLength(intext); +#else + pysize = PyUnicode_GetSize(intext); +#endif unichars = PyUnicode_AS_UNICODE(intext); } else {