TD: [skip ci] Fix several clazy issues:
* Using copy-ctor but class TechDraw::anglePoints has a trivial copy-ctor but non trivial assign operator [-Wclazy-rule-of-two-soft] * Using copy-ctor but class TechDraw::arcPoints has a trivial copy-ctor but non trivial assign operator [-Wclazy-rule-of-two-soft] * Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference] * C++11 range-loop might detach Qt container (QList) [-Wclazy-range-loop-detach] * signal arguments need to be fully-qualified (TechDrawGui::QGIView instead of QGIView) [-Wclazy-fully-qualified-moc-types] * Use multi-arg instead [-Wclazy-qstring-arg] * Use midRef() instead [-Wclazy-qstring-ref]
This commit is contained in:
@@ -119,7 +119,7 @@ void copy(Py::Dict sourceRange, OutputIt targetIt)
|
||||
string key;
|
||||
string value;
|
||||
|
||||
for (auto keyPy : sourceRange.keys()) {
|
||||
for (const auto& keyPy : sourceRange.keys()) {
|
||||
key = Py::String(keyPy);
|
||||
value = Py::String(sourceRange[keyPy]);
|
||||
*targetIt = {key, value};
|
||||
|
||||
@@ -446,7 +446,7 @@ std::vector<TopoDS_Edge> DrawProjectSplit::removeDuplicateEdges(std::vector<Topo
|
||||
sorted.erase(last, sorted.end()); //remove dupls
|
||||
|
||||
//TODO: "sorted" turns to garbage if pagescale set to "0.1"!!!!???? ***
|
||||
for (auto e: sorted) {
|
||||
for (const auto& e: sorted) {
|
||||
if (e.idx < inEdges.size()) {
|
||||
result.push_back(inEdges.at(e.idx)); //<<< ***here
|
||||
} else {
|
||||
|
||||
@@ -59,6 +59,20 @@ struct anglePoints
|
||||
ends.second = Base::Vector3d(0.0,0.0,0.0);
|
||||
vertex = Base::Vector3d(0.0,0.0,0.0);
|
||||
}
|
||||
|
||||
anglePoints(const anglePoints& ap)
|
||||
: ends(ap.ends)
|
||||
, vertex(ap.vertex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
anglePoints& operator= (const anglePoints& ap)
|
||||
{
|
||||
ends = ap.ends;
|
||||
vertex = ap.vertex;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct arcPoints
|
||||
@@ -84,6 +98,29 @@ struct arcPoints
|
||||
arcCW = false;
|
||||
}
|
||||
|
||||
arcPoints(const arcPoints& ap)
|
||||
: isArc(ap.isArc)
|
||||
, radius(ap.radius)
|
||||
, center(ap.center)
|
||||
, onCurve(ap.onCurve)
|
||||
, arcEnds(ap.arcEnds)
|
||||
, midArc(ap.midArc)
|
||||
, arcCW(ap.arcCW)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
arcPoints& operator= (const arcPoints& ap)
|
||||
{
|
||||
isArc = ap.isArc;
|
||||
radius = ap.radius;
|
||||
center = ap.center;
|
||||
onCurve = ap.onCurve;
|
||||
arcEnds = ap.arcEnds;
|
||||
midArc = ap.midArc;
|
||||
arcCW = ap.arcCW;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class TechDrawExport DrawViewDimension : public TechDraw::DrawView
|
||||
|
||||
@@ -283,7 +283,7 @@ TopoDS_Wire EdgeWalker::makeCleanWire(std::vector<TopoDS_Edge> edges, double tol
|
||||
ShapeFix_ShapeTolerance sTol;
|
||||
Handle(ShapeExtend_WireData) wireData = new ShapeExtend_WireData();
|
||||
|
||||
for (auto e:edges) {
|
||||
for (const auto& e:edges) {
|
||||
wireData->Add(e);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ std::vector<TopoDS_Vertex> EdgeWalker:: makeUniqueVList(std::vector<TopoDS_Edge>
|
||||
TopoDS_Vertex v2 = TopExp::LastVertex(e);
|
||||
bool addv1 = true;
|
||||
bool addv2 = true;
|
||||
for (auto v:uniqueVert) {
|
||||
for (const auto& v:uniqueVert) {
|
||||
if (DrawUtil::isSamePoint(v,v1,EWTOLERANCE))
|
||||
addv1 = false;
|
||||
if (DrawUtil::isSamePoint(v,v2,EWTOLERANCE))
|
||||
@@ -336,7 +336,7 @@ std::vector<WalkerEdge> EdgeWalker::makeWalkerEdges(std::vector<TopoDS_Edge> edg
|
||||
// Base::Console().Message("TRACE - EW::makeWalkerEdges()\n");
|
||||
m_saveInEdges = edges;
|
||||
std::vector<WalkerEdge> walkerEdges;
|
||||
for (auto e:edges) {
|
||||
for (const auto& e:edges) {
|
||||
TopoDS_Vertex ev1 = TopExp::FirstVertex(e);
|
||||
TopoDS_Vertex ev2 = TopExp::LastVertex(e);
|
||||
int v1dx = findUniqueVert(ev1, verts);
|
||||
|
||||
@@ -1140,8 +1140,8 @@ void CmdTechDrawSymbol::activated(int iMsg)
|
||||
QString filename = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(),
|
||||
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")));
|
||||
arg(QObject::tr("Scalable Vector Graphic"),
|
||||
QObject::tr("All Files")));
|
||||
|
||||
if (!filename.isEmpty())
|
||||
{
|
||||
|
||||
@@ -2306,7 +2306,7 @@ namespace TechDrawGui {
|
||||
// get subNames and coordinates of all selected vertexes
|
||||
std::vector<dimVertex> vertexes;
|
||||
dimVertex nextVertex;
|
||||
for (std::string name : subNames) {
|
||||
for (const std::string& name : subNames) {
|
||||
std::string geoType = TechDraw::DrawUtil::getGeomTypeFromName(name);
|
||||
if (geoType == "Vertex") {
|
||||
int geoId = TechDraw::DrawUtil::getIndexFromName(name);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace TechDrawGui {
|
||||
return;
|
||||
const std::vector<std::string> SubNames = selection[0].getSubNames();
|
||||
std::vector<TechDraw::CirclePtr> Circles;
|
||||
for (std::string Name : SubNames) {
|
||||
for (const std::string& Name : SubNames) {
|
||||
int GeoId = TechDraw::DrawUtil::getIndexFromName(Name);
|
||||
std::string GeoType = TechDraw::DrawUtil::getGeomTypeFromName(Name);
|
||||
TechDraw::BaseGeomPtr geom = objFeat->getGeomByIndex(GeoId);
|
||||
@@ -138,7 +138,7 @@ namespace TechDrawGui {
|
||||
std::string bigCircleTag = objFeat->addCosmeticEdge(bigCircle);
|
||||
TechDraw::CosmeticEdge* ceCircle = objFeat->getCosmeticEdge(bigCircleTag);
|
||||
_setLineAttributes(ceCircle);
|
||||
for (TechDraw::CirclePtr oneCircle : Circles) {
|
||||
for (const TechDraw::CirclePtr& oneCircle : Circles) {
|
||||
Base::Vector3d oneCircleCenter = oneCircle->center;
|
||||
float oneRadius = oneCircle->radius;
|
||||
Base::Vector3d delta = (oneCircle->center - bigCenter).Normalize() * (oneRadius + 2);
|
||||
@@ -201,7 +201,7 @@ void execCircleCenterLines(Gui::Command* cmd) {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Circle Centerlines"));
|
||||
double scale = objFeat->getScale();
|
||||
const std::vector<std::string> SubNames = selection[0].getSubNames();
|
||||
for (std::string Name : SubNames) {
|
||||
for (const std::string& Name : SubNames) {
|
||||
int GeoId = TechDraw::DrawUtil::getIndexFromName(Name);
|
||||
TechDraw::BaseGeomPtr geom = objFeat->getGeomByIndex(GeoId);
|
||||
std::string GeoType = TechDraw::DrawUtil::getGeomTypeFromName(Name);
|
||||
@@ -476,7 +476,7 @@ void execThreadHoleBottom(Gui::Command* cmd) {
|
||||
return;
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Cosmetic Thread Hole Bottom"));
|
||||
const std::vector<std::string> SubNames = selection[0].getSubNames();
|
||||
for (std::string Name : SubNames) {
|
||||
for (const std::string& Name : SubNames) {
|
||||
_createThreadCircle(Name, objFeat, 1.177f);
|
||||
}
|
||||
cmd->getSelection().clearSelection();
|
||||
@@ -527,7 +527,7 @@ void execThreadBoltBottom(Gui::Command* cmd) {
|
||||
return;
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Cosmetic Thread Bolt Bottom"));
|
||||
const std::vector<std::string> SubNames = selection[0].getSubNames();
|
||||
for (std::string Name : SubNames) {
|
||||
for (const std::string& Name : SubNames) {
|
||||
_createThreadCircle(Name, objFeat, 0.85f);
|
||||
}
|
||||
cmd->getSelection().clearSelection();
|
||||
@@ -763,7 +763,7 @@ void CmdTechDrawExtensionChangeLineAttributes::activated(int iMsg) {
|
||||
return;
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Change Line Attributes"));
|
||||
const std::vector<std::string> subNames = selection[0].getSubNames();
|
||||
for (std::string name : subNames) {
|
||||
for (const std::string& name : subNames) {
|
||||
int num = DrawUtil::getIndexFromName(name);
|
||||
BaseGeomPtr baseGeo = objFeat->getGeomByIndex(num);
|
||||
if (baseGeo) {
|
||||
@@ -1767,7 +1767,7 @@ void CmdTechDrawExtensionAreaAnnotation::activated(int iMsg)
|
||||
int idx = TechDraw::DrawUtil::getIndexFromName(name);
|
||||
std::vector<TechDraw::BaseGeomPtr> faceEdges = objFeat->getFaceEdgesByIndex(idx);
|
||||
// We filter arcs, circles etc. which are not allowed.
|
||||
for (TechDraw::BaseGeomPtr geoPtr : faceEdges)
|
||||
for (const TechDraw::BaseGeomPtr& geoPtr : faceEdges)
|
||||
if (geoPtr->geomType != TechDraw::GENERIC)
|
||||
throw Base::TypeError("CmdTechDrawAreaAnnotation - forbidden border element found\n");
|
||||
// We create a list of all points along the boundary of the face.
|
||||
@@ -1923,7 +1923,7 @@ namespace TechDrawGui {
|
||||
std::vector<Base::Vector3d> _getVertexPoints(std::vector<std::string> SubNames, TechDraw::DrawViewPart* objFeat) {
|
||||
// get vertex points as Vector3d
|
||||
std::vector<Base::Vector3d> vertexPoints;
|
||||
for (std::string Name : SubNames) {
|
||||
for (const std::string& Name : SubNames) {
|
||||
std::string GeoType = TechDraw::DrawUtil::getGeomTypeFromName(Name);
|
||||
if (GeoType == "Vertex") {
|
||||
int GeoId = TechDraw::DrawUtil::getIndexFromName(Name);
|
||||
|
||||
@@ -74,7 +74,7 @@ void DlgPageChooser::fillList(std::vector<std::string> labels, std::vector<std::
|
||||
for (; i < labelCount; i++) {
|
||||
qLabel = Base::Tools::fromStdString(labels[i]);
|
||||
qName = Base::Tools::fromStdString(names[i]);
|
||||
qText = QString::fromUtf8("%1 (%2)").arg(qLabel).arg(qName);
|
||||
qText = QString::fromUtf8("%1 (%2)").arg(qLabel, qName);
|
||||
item = new QListWidgetItem(qText, ui->lwPages);
|
||||
item->setData(Qt::UserRole, qName);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ TechDraw::DrawPage* DrawGuiUtil::findPage(Gui::Command* cmd)
|
||||
Gui::MDIView* mv = w->activeWindow();
|
||||
MDIViewPage* mvp = dynamic_cast<MDIViewPage*>(mv);
|
||||
if (mvp) {
|
||||
QString windowTitle = mvp->windowTitle();
|
||||
QGSPage* qp = mvp->getQGSPage();
|
||||
page = qp->getDrawPage();
|
||||
}
|
||||
|
||||
@@ -179,7 +179,6 @@ double Grabber3d::copyActiveViewToSvgFile(App::Document* appDoc,
|
||||
Base::Console().Error("G3D::copyActiveViewToSvgFile - can not open file - %s/n", fileSpec.c_str());
|
||||
return result;
|
||||
}
|
||||
QColor dbColor(Qt::blue);
|
||||
execVectorizeAction(viewerSvg,
|
||||
va.get(),
|
||||
outWidth, outHeight,
|
||||
|
||||
@@ -1101,7 +1101,7 @@ void MDIViewPage::sceneSelectionManager()
|
||||
//add to m_qgSceneSelected anything that is in q_sceneSel
|
||||
for (auto qts: sceneSel) {
|
||||
bool found = false;
|
||||
for (auto ms: m_qgSceneSelected) {
|
||||
for (auto ms: qAsConst(m_qgSceneSelected)) {
|
||||
if ( qts == ms ) {
|
||||
found = true;
|
||||
break;
|
||||
@@ -1115,7 +1115,7 @@ void MDIViewPage::sceneSelectionManager()
|
||||
|
||||
//remove items from m_qgSceneSelected that are not in q_sceneSel
|
||||
QList<QGraphicsItem*> m_new;
|
||||
for (auto m: m_qgSceneSelected) {
|
||||
for (auto m: qAsConst(m_qgSceneSelected)) {
|
||||
for (auto q: sceneSel) {
|
||||
if (m == q) {
|
||||
m_new.push_back(m);
|
||||
@@ -1455,7 +1455,7 @@ Py::Object MDIViewPagePy::getattr(const char * attr)
|
||||
if (name == "__dict__" || name == "__class__") {
|
||||
Py::Dict dict_self(BaseType::getattr("__dict__"));
|
||||
Py::Dict dict_base(base.getattr("__dict__"));
|
||||
for (auto it : dict_base) {
|
||||
for (const auto& it : dict_base) {
|
||||
dict_self.setItem(it.first, it.second);
|
||||
}
|
||||
return dict_self;
|
||||
|
||||
@@ -208,7 +208,6 @@ void QGIRichAnno::setTextItem()
|
||||
if (!getExporting()) {
|
||||
//convert point font sizes to (Rez,mm) font sizes
|
||||
QRegExp rxFontSize(QString::fromUtf8("font-size:([0-9]*)pt;"));
|
||||
QString match;
|
||||
double mmPerPoint = 0.353;
|
||||
double sizeConvert = Rez::getRezFactor() * mmPerPoint;
|
||||
int pos = 0;
|
||||
|
||||
@@ -397,7 +397,6 @@ void QGSPage::createBalloon(QPointF origin, DrawViewPart *parent)
|
||||
balloon->Y.setValue(appOrigin.y() + textOffset);
|
||||
|
||||
int idx = getDrawPage()->getNextBalloonIndex();
|
||||
QString labelText = QString::number(idx);
|
||||
balloon->Text.setValue(std::to_string(idx).c_str());
|
||||
|
||||
Command::doCommand(Command::Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)", pageName.c_str(), featName.c_str());
|
||||
|
||||
@@ -78,8 +78,8 @@ public:
|
||||
QPointF snapToAngle(QPointF pt);
|
||||
|
||||
Q_SIGNALS:
|
||||
void drawingFinished(std::vector<QPointF> pts, QGIView* qgParent);
|
||||
void qViewPicked(QPointF pos, QGIView* qgParent);
|
||||
void drawingFinished(std::vector<QPointF> pts, TechDrawGui::QGIView* qgParent);
|
||||
void qViewPicked(QPointF pos, TechDrawGui::QGIView* qgParent);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void onTrackerClicked(bool b);
|
||||
void onTrackerFinished(std::vector<QPointF> pts, QGIView* qgParent);
|
||||
void onTrackerFinished(std::vector<QPointF> pts, TechDrawGui::QGIView* qgParent);
|
||||
|
||||
public:
|
||||
virtual bool accept();
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
public Q_SLOTS:
|
||||
void onTrackerClicked(bool b);
|
||||
void onCancelEditClicked(bool b);
|
||||
void onTrackerFinished(std::vector<QPointF> pts, QGIView* qgParent);
|
||||
void onTrackerFinished(std::vector<QPointF> pts, TechDrawGui::QGIView* qgParent);
|
||||
|
||||
public:
|
||||
virtual bool accept();
|
||||
|
||||
@@ -192,7 +192,7 @@ void TaskProjGroup::viewToggled(bool toggle)
|
||||
bool changed = false;
|
||||
// Obtain name of checkbox
|
||||
QString viewName = sender()->objectName();
|
||||
int index = viewName.mid(7).toInt();
|
||||
int index = viewName.midRef(7).toInt();
|
||||
const char *viewNameCStr = viewChkIndexToCStr(index);
|
||||
if ( toggle && !multiView->hasProjection( viewNameCStr ) ) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
@@ -498,9 +498,9 @@ void TaskProjGroup::setUiPrimary()
|
||||
QString TaskProjGroup::formatVector(Base::Vector3d v)
|
||||
{
|
||||
QString data = QString::fromLatin1("[%1 %2 %3]")
|
||||
.arg(QLocale().toString(v.x, 'f', 2))
|
||||
.arg(QLocale().toString(v.y, 'f', 2))
|
||||
.arg(QLocale().toString(v.z, 'f', 2));
|
||||
.arg(QLocale().toString(v.x, 'f', 2),
|
||||
QLocale().toString(v.y, 'f', 2),
|
||||
QLocale().toString(v.z, 'f', 2));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ void TaskSurfaceFinishSymbols::setUiEdit()
|
||||
// QComboBox showing RA values
|
||||
cbRA = new(QComboBox);
|
||||
cbRA->resize(90,20);
|
||||
for (std::string nextValue : raValues)
|
||||
for (const std::string& nextValue : raValues)
|
||||
cbRA->addItem(QString::fromStdString(nextValue));
|
||||
cbRA->setToolTip(QObject::tr("Average roughness"));
|
||||
proxyRA = symbolScene->addWidget(cbRA);
|
||||
@@ -224,7 +224,7 @@ void TaskSurfaceFinishSymbols::setUiEdit()
|
||||
// QComboBox showing lay symbol
|
||||
cbLay = new(QComboBox);
|
||||
cbLay->resize(40,20);
|
||||
for (std::string nextLay : laySymbols)
|
||||
for (const std::string& nextLay : laySymbols)
|
||||
cbLay->addItem(QString::fromStdString(nextLay));
|
||||
cbLay->setToolTip(QObject::tr("Lay symbol"));
|
||||
QGraphicsProxyWidget* proxyLay = symbolScene->addWidget(cbLay);
|
||||
@@ -232,7 +232,7 @@ void TaskSurfaceFinishSymbols::setUiEdit()
|
||||
// QComboBox showing minimal roughness grade
|
||||
cbMinRought = new(QComboBox);
|
||||
cbMinRought->resize(55,20);
|
||||
for (std::string nextGrade : roughGrades)
|
||||
for (const std::string& nextGrade : roughGrades)
|
||||
cbMinRought->addItem(QString::fromStdString(nextGrade));
|
||||
cbMinRought->setToolTip(QObject::tr("Minimum roughness grade number"));
|
||||
proxyMinRough = symbolScene->addWidget(cbMinRought);
|
||||
@@ -242,7 +242,7 @@ void TaskSurfaceFinishSymbols::setUiEdit()
|
||||
// QComboBox showing maximal roughness grade
|
||||
cbMaxRought = new(QComboBox);
|
||||
cbMaxRought->resize(55,20);
|
||||
for (std::string nextGrade : roughGrades)
|
||||
for (const std::string& nextGrade : roughGrades)
|
||||
cbMaxRought->addItem(QString::fromStdString(nextGrade));
|
||||
cbMaxRought->setToolTip(QObject::tr("Maximum roughness grade number"));
|
||||
proxyMaxRough = symbolScene->addWidget(cbMaxRought);
|
||||
|
||||
@@ -182,7 +182,7 @@ bool ViewProviderProjGroup::onDelete(const std::vector<std::string> &)
|
||||
bodyMessageStream << qApp->translate("Std_Delete",
|
||||
"The group cannot be deleted because its items have the following\nsection or detail views, or leader lines that would get broken:");
|
||||
bodyMessageStream << '\n';
|
||||
for (auto ListIterator : ViewList)
|
||||
for (const auto& ListIterator : ViewList)
|
||||
bodyMessageStream << '\n' << QString::fromUtf8(ListIterator.c_str());
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||
|
||||
@@ -201,7 +201,8 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
|
||||
// font size
|
||||
|
||||
QFontDatabase db;
|
||||
for(int size: db.standardSizes()) {
|
||||
const auto sizes = db.standardSizes();
|
||||
for(int size: sizes) {
|
||||
f_fontsize->addItem(QString::number(size));
|
||||
}
|
||||
//TODO: void QComboBox::setEditText(const QString &text) to " " when multiple select
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
*/
|
||||
// clazy:excludeall=qstring-arg
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "mtextedit.h"
|
||||
|
||||
Reference in New Issue
Block a user