[TD]CI clang warnings
This commit is contained in:
@@ -47,11 +47,11 @@ SvgString::SvgString(int width, int height)
|
||||
svgStream << "<svg width='" << width << "' height='" << height << "'>\n";
|
||||
}
|
||||
|
||||
void SvgString::addLine(int x1, int y1, int x2, int y2)
|
||||
void SvgString::addLine(int xStart, int yStart, int xEnd, int yEnd)
|
||||
{
|
||||
svgStream << "<path stroke='#000' stroke-width='1' d='";
|
||||
svgStream << " M" << x1 << "," << y1; // startpoint
|
||||
svgStream << " L" << x2 << "," << y2; // endpoint
|
||||
svgStream << " M" << xStart << ", " << yStart; // startpoint
|
||||
svgStream << " L" << xEnd << ", " << yEnd; // endpoint
|
||||
svgStream << "' />\n";
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ TaskSurfaceFinishSymbols::TaskSurfaceFinishSymbols(TechDraw::DrawViewPart* view)
|
||||
selectedView(view),
|
||||
ui(new Ui_TaskSurfaceFinishSymbols)
|
||||
{
|
||||
raValues = {"RA50","RA25","RA12,5","RA6,3",
|
||||
"RA3,2","RA1,6","RA0,8","RA0,4",
|
||||
"RA0,2","RA0,1","RA0,05","RA0,025"};
|
||||
laySymbols = {"","=","⟂","X","M","C","R"};
|
||||
roughGrades = {"","N1","N2","N3","N4","N5",
|
||||
"N6","N7","N8","N9","N10","N11"};
|
||||
raValues = {"RA50", "RA25", "RA12, 5", "RA6, 3",
|
||||
"RA3, 2", "RA1, 6", "RA0, 8", "RA0, 4",
|
||||
"RA0, 2", "RA0, 1", "RA0, 05", "RA0, 025"};
|
||||
laySymbols = {"", "=", "⟂", "X", "M", "C", "R"};
|
||||
roughGrades = {"", "N1", "N2", "N3", "N4", "N5",
|
||||
"N6", "N7", "N8", "N9", "N10", "N11"};
|
||||
ui->setupUi(this);
|
||||
setUiEdit();
|
||||
}
|
||||
@@ -95,8 +95,8 @@ TaskSurfaceFinishSymbols::TaskSurfaceFinishSymbols(TechDraw::DrawViewPart* view)
|
||||
QPixmap TaskSurfaceFinishSymbols::baseSymbol(symbolType type)
|
||||
// return QPixmap showing a base symbol
|
||||
{
|
||||
QImage img (50,64,QImage::Format_ARGB32_Premultiplied);
|
||||
img.fill(QColor(240,240,240));
|
||||
QImage img (50, 64, QImage::Format_ARGB32_Premultiplied);
|
||||
img.fill(QColor(240, 240, 240));
|
||||
QPainter painter;
|
||||
painter.begin(&img);
|
||||
painter.setPen(QPen(Qt::black, 2, Qt::SolidLine,
|
||||
@@ -104,14 +104,14 @@ QPixmap TaskSurfaceFinishSymbols::baseSymbol(symbolType type)
|
||||
painter.setRenderHints(QPainter::Antialiasing |
|
||||
QPainter::SmoothPixmapTransform |
|
||||
QPainter::TextAntialiasing);
|
||||
painter.drawLine(QLine(0,44,12,64));
|
||||
painter.drawLine(QLine(12,64,42,14));
|
||||
painter.drawLine(QLine(0, 44, 12, 64));
|
||||
painter.drawLine(QLine(12, 64, 42, 14));
|
||||
if (type == removeProhibit || type == removeProhibitAll)
|
||||
painter.drawEllipse(QPoint(12,46),9,9);
|
||||
painter.drawEllipse(QPoint(12, 46), 9,9);
|
||||
if (type == removeRequired || type == removeRequiredAll)
|
||||
painter.drawLine(QLine(0,44,24,44));
|
||||
painter.drawLine(QLine(0, 44, 24, 44));
|
||||
if (type > removeRequired)
|
||||
painter.drawEllipse(QPoint(42,14),6,6);
|
||||
painter.drawEllipse(QPoint(42, 14), 6,6);
|
||||
painter.end();
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
||||
@@ -119,52 +119,47 @@ QPixmap TaskSurfaceFinishSymbols::baseSymbol(symbolType type)
|
||||
std::string TaskSurfaceFinishSymbols::completeSymbol()
|
||||
// return string showing the complete symbol
|
||||
{
|
||||
SvgString symbol(150,64);
|
||||
symbol.addLine(0,44,12,64);
|
||||
symbol.addLine(12,64,42,14);
|
||||
SvgString symbol(150, 64);
|
||||
symbol.addLine(0, 44, 12, 64);
|
||||
symbol.addLine(12, 64, 42, 14);
|
||||
int moveLeft(0), maxTextLength(0);
|
||||
if (activeIcon == removeProhibit || activeIcon == removeProhibitAll)
|
||||
symbol.addCircle(12,46,9);
|
||||
symbol.addCircle(12, 46, 9);
|
||||
if (activeIcon == removeRequired || activeIcon == removeRequiredAll)
|
||||
symbol.addLine(0,44,24,44);
|
||||
symbol.addLine(0, 44, 24, 44);
|
||||
if (activeIcon > removeRequired)
|
||||
{
|
||||
symbol.addCircle(42,14,6);
|
||||
symbol.addCircle(42, 14, 6);
|
||||
moveLeft = 5 ;
|
||||
}
|
||||
std::string methodText = leMethod->text().toStdString();
|
||||
symbol.addText(42+moveLeft,11,methodText);
|
||||
symbol.addText(42+moveLeft, 11, methodText);
|
||||
int methodTextLength = methodText.length();
|
||||
if (isISO)
|
||||
{
|
||||
std::string raText = cbRA->itemText(cbRA->currentIndex()).toStdString();
|
||||
symbol.addText(42+moveLeft,30,raText);
|
||||
symbol.addText(42+moveLeft, 30, raText);
|
||||
int raTextLength = raText.length();
|
||||
maxTextLength = std::max(methodTextLength,raTextLength)*9.25+moveLeft;
|
||||
maxTextLength = std::max(methodTextLength, raTextLength)*9.25+moveLeft;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string sampleText = leSamLength->text().toStdString();
|
||||
symbol.addText(42+moveLeft,30,sampleText);
|
||||
symbol.addText(42+moveLeft, 30, sampleText);
|
||||
int sampleTextLength = sampleText.length();
|
||||
maxTextLength = std::max(methodTextLength,sampleTextLength)*9.25+moveLeft;
|
||||
maxTextLength = std::max(methodTextLength, sampleTextLength)*9.25+moveLeft;
|
||||
std::string minRoughtText = cbMinRought->itemText(cbMinRought->currentIndex()).toStdString();
|
||||
symbol.addText(-10,35,minRoughtText);
|
||||
symbol.addText(-10, 35, minRoughtText);
|
||||
std::string maxRoughtText = cbMaxRought->itemText(cbMaxRought->currentIndex()).toStdString();
|
||||
symbol.addText(-10,20,maxRoughtText);
|
||||
symbol.addText(-10, 20, maxRoughtText);
|
||||
}
|
||||
symbol.addLine(42,14,42+maxTextLength,14);
|
||||
symbol.addText(20,60,cbLay->itemText(cbLay->currentIndex()).toStdString());
|
||||
symbol.addText(-25,60,leAddition->text().toStdString());
|
||||
symbol.addLine(42, 14, 42+maxTextLength, 14);
|
||||
symbol.addText(20, 60, cbLay->itemText(cbLay->currentIndex()).toStdString());
|
||||
symbol.addText(-25, 60, leAddition->text().toStdString());
|
||||
std::string symbolAsString = symbol.finish();
|
||||
return symbolAsString;
|
||||
}
|
||||
|
||||
TaskSurfaceFinishSymbols::~TaskSurfaceFinishSymbols()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TaskSurfaceFinishSymbols::updateTask()
|
||||
{
|
||||
// blockUpdate = true;
|
||||
@@ -173,9 +168,9 @@ void TaskSurfaceFinishSymbols::updateTask()
|
||||
}
|
||||
|
||||
|
||||
void TaskSurfaceFinishSymbols::changeEvent(QEvent *e)
|
||||
void TaskSurfaceFinishSymbols::changeEvent(QEvent *event)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
@@ -199,69 +194,69 @@ void TaskSurfaceFinishSymbols::setUiEdit()
|
||||
ui->graphicsView->setScene(symbolScene);
|
||||
// QLineEdit showing method
|
||||
leMethod = new(QLineEdit);
|
||||
leMethod->resize(90,20);
|
||||
leMethod->resize(90, 20);
|
||||
leMethod->setToolTip(QObject::tr("Method"));
|
||||
QGraphicsProxyWidget* proxyMethod = symbolScene->addWidget(leMethod);
|
||||
proxyMethod->setPos(2,-142);
|
||||
proxyMethod->setPos(2, -142);
|
||||
// QLineEdit showing addition
|
||||
leAddition = new(QLineEdit);
|
||||
leAddition->resize(25,20);
|
||||
leAddition->resize(25, 20);
|
||||
leAddition->setToolTip(QObject::tr("Addition"));
|
||||
QGraphicsProxyWidget* proxyAddition = symbolScene->addWidget(leAddition);
|
||||
proxyAddition->setPos(-80,-85);
|
||||
proxyAddition->setPos(-80, -85);
|
||||
proxyAddition->setZValue(-2);
|
||||
// QComboBox showing RA values
|
||||
cbRA = new(QComboBox);
|
||||
cbRA->resize(90,20);
|
||||
cbRA->resize(90, 20);
|
||||
for (const std::string& nextValue : raValues)
|
||||
cbRA->addItem(QString::fromStdString(nextValue));
|
||||
cbRA->setToolTip(QObject::tr("Average roughness"));
|
||||
proxyRA = symbolScene->addWidget(cbRA);
|
||||
proxyRA->setPos(2,-113);
|
||||
proxyRA->setPos(2, -113);
|
||||
// QLineEdit showing sampling length value
|
||||
leSamLength = new(QLineEdit);
|
||||
leSamLength->resize(90,20);
|
||||
leSamLength->resize(90, 20);
|
||||
leSamLength->setToolTip(QObject::tr("Roughness sampling length"));
|
||||
proxySamLength = symbolScene->addWidget(leSamLength);
|
||||
proxySamLength->setPos(2,-113);
|
||||
proxySamLength->setPos(2, -113);
|
||||
proxySamLength->hide();
|
||||
// QComboBox showing lay symbol
|
||||
cbLay = new(QComboBox);
|
||||
cbLay->resize(40,20);
|
||||
cbLay->resize(40, 20);
|
||||
for (const std::string& nextLay : laySymbols)
|
||||
cbLay->addItem(QString::fromStdString(nextLay));
|
||||
cbLay->setToolTip(QObject::tr("Lay symbol"));
|
||||
QGraphicsProxyWidget* proxyLay = symbolScene->addWidget(cbLay);
|
||||
proxyLay->setPos(-23,-85);
|
||||
proxyLay->setPos(-23, -85);
|
||||
// QComboBox showing minimal roughness grade
|
||||
cbMinRought = new(QComboBox);
|
||||
cbMinRought->resize(55,20);
|
||||
cbMinRought->resize(55, 20);
|
||||
for (const std::string& nextGrade : roughGrades)
|
||||
cbMinRought->addItem(QString::fromStdString(nextGrade));
|
||||
cbMinRought->setToolTip(QObject::tr("Minimum roughness grade number"));
|
||||
proxyMinRough = symbolScene->addWidget(cbMinRought);
|
||||
proxyMinRough->setPos(-80,-118);
|
||||
proxyMinRough->setPos(-80, -118);
|
||||
proxyMinRough-> setZValue(1);
|
||||
proxyMinRough->hide();
|
||||
// QComboBox showing maximal roughness grade
|
||||
cbMaxRought = new(QComboBox);
|
||||
cbMaxRought->resize(55,20);
|
||||
cbMaxRought->resize(55, 20);
|
||||
for (const std::string& nextGrade : roughGrades)
|
||||
cbMaxRought->addItem(QString::fromStdString(nextGrade));
|
||||
cbMaxRought->setToolTip(QObject::tr("Maximum roughness grade number"));
|
||||
proxyMaxRough = symbolScene->addWidget(cbMaxRought);
|
||||
proxyMaxRough->setPos(-80,-143);
|
||||
proxyMaxRough->setPos(-80, -143);
|
||||
proxyMaxRough->setZValue(1);
|
||||
proxyMaxRough->hide();
|
||||
// add horizontal line
|
||||
symbolScene->addLine(QLine(-8,-116,90,-116),
|
||||
QPen(Qt::black,2,Qt::SolidLine,
|
||||
symbolScene->addLine(QLine(-8, -116, 90, -116),
|
||||
QPen(Qt::black, 2,Qt::SolidLine,
|
||||
Qt::RoundCap, Qt::RoundJoin));
|
||||
// add pixmap of the surface finish symbol
|
||||
QIcon symbolIcon = ui->pbIcon01->icon();
|
||||
QGraphicsPixmapItem* pixmapItem = new(QGraphicsPixmapItem);
|
||||
pixmapItem->setPixmap(symbolIcon.pixmap(50,64));
|
||||
pixmapItem->setPos(-50,-130);
|
||||
pixmapItem->setPixmap(symbolIcon.pixmap(50, 64));
|
||||
pixmapItem->setPos(-50, -130);
|
||||
pixmapItem->setZValue(-1);
|
||||
symbolScene->addItem(pixmapItem);
|
||||
|
||||
@@ -290,11 +285,11 @@ void TaskSurfaceFinishSymbols::onIconChanged()
|
||||
if (ui->pbIcon04 == pressedButton) activeIcon = anyMethodAll;
|
||||
if (ui->pbIcon05 == pressedButton) activeIcon = removeProhibitAll;
|
||||
if (ui->pbIcon06 == pressedButton) activeIcon = removeRequiredAll;
|
||||
|
||||
|
||||
QIcon symbolIcon = pressedButton->icon();
|
||||
QGraphicsPixmapItem* pixmapItem = new(QGraphicsPixmapItem);
|
||||
pixmapItem->setPixmap(symbolIcon.pixmap(50,64));
|
||||
pixmapItem->setPos(-50,-130);
|
||||
pixmapItem->setPixmap(symbolIcon.pixmap(50, 64));
|
||||
pixmapItem->setPos(-50, -130);
|
||||
pixmapItem->setZValue(-1);
|
||||
symbolScene->addItem(pixmapItem);
|
||||
}
|
||||
@@ -316,7 +311,7 @@ void TaskSurfaceFinishSymbols::onASME()
|
||||
proxySamLength->show();
|
||||
proxyMinRough->show();
|
||||
proxyMaxRough->show();
|
||||
proxyRA->hide();
|
||||
proxyRA->hide();
|
||||
}
|
||||
|
||||
bool TaskSurfaceFinishSymbols::accept()
|
||||
@@ -324,7 +319,7 @@ bool TaskSurfaceFinishSymbols::accept()
|
||||
{
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Surface Finish Symbols"));
|
||||
App::Document *doc = Application::Instance->activeDocument()->getDocument();
|
||||
App::DocumentObject *docObject = doc->addObject("TechDraw::DrawViewSymbol","SurfaceSymbol");
|
||||
App::DocumentObject *docObject = doc->addObject("TechDraw::DrawViewSymbol", "SurfaceSymbol");
|
||||
TechDraw::DrawViewSymbol *surfaceSymbol = dynamic_cast<TechDraw::DrawViewSymbol*>(docObject);
|
||||
surfaceSymbol->Symbol.setValue(completeSymbol());
|
||||
surfaceSymbol->Rotation.setValue(ui->leAngle->text().toDouble());
|
||||
|
||||
Reference in New Issue
Block a user