[Gui] fix some CI warnings

- narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined
- floating point literal has suffix 'f', which is not uppercase
- narrowing conversion from 'double' to 'float'
- Slots named on_foo_bar are error prone
- also tome Clang style fixes

(see here for the reports: https://github.com/FreeCAD/FreeCAD/pull/7522/commits/d9c2efcc)
This commit is contained in:
Uwe
2022-09-24 19:58:11 +02:00
parent 2849d7bec3
commit 2ef4b7a06b
5 changed files with 24 additions and 24 deletions

View File

@@ -116,7 +116,7 @@ void DlgRunExternal::finished (int exitCode, QProcess::ExitStatus exitStatus)
ui->buttonAbort->setEnabled(false);
}
void DlgRunExternal::on_chooseProgram_clicked()
void DlgRunExternal::onChooseProgramClicked()
{
QString fn;
fn = QFileDialog::getOpenFileName(this, tr("Select a file"), ui->programPath->text());

View File

@@ -55,7 +55,7 @@ protected Q_SLOTS:
virtual void abort();
virtual void advanced();
void finished (int exitCode, QProcess::ExitStatus exitStatus);
void on_chooseProgram_clicked();
void onChooseProgramClicked();
protected:
QProcess process;

View File

@@ -261,16 +261,16 @@ void ActionSelector::keyPressEvent(QKeyEvent* event)
switch (event->key())
{
case Qt::Key_Right:
on_addButton_clicked();
onAddButtonClicked();
break;
case Qt::Key_Left:
on_removeButton_clicked();
onRemoveButtonClicked();
break;
case Qt::Key_Up:
on_upButton_clicked();
onUpButtonClicked();
break;
case Qt::Key_Down:
on_downButton_clicked();
onDownButtonClicked();
break;
default:
event->ignore();
@@ -313,7 +313,7 @@ void ActionSelector::onItemDoubleClicked(QTreeWidgetItem * item, int column)
}
}
void ActionSelector::on_addButton_clicked()
void ActionSelector::onAddButtonClicked()
{
QTreeWidgetItem* item = availableWidget->currentItem();
if (item) {
@@ -325,7 +325,7 @@ void ActionSelector::on_addButton_clicked()
}
}
void ActionSelector::on_removeButton_clicked()
void ActionSelector::onRemoveButtonClicked()
{
QTreeWidgetItem* item = selectedWidget->currentItem();
if (item) {
@@ -337,7 +337,7 @@ void ActionSelector::on_removeButton_clicked()
}
}
void ActionSelector::on_upButton_clicked()
void ActionSelector::onUpButtonClicked()
{
QTreeWidgetItem* item = selectedWidget->currentItem();
if (item && item->isSelected()) {
@@ -350,7 +350,7 @@ void ActionSelector::on_upButton_clicked()
}
}
void ActionSelector::on_downButton_clicked()
void ActionSelector::onDownButtonClicked()
{
QTreeWidgetItem* item = selectedWidget->currentItem();
if (item && item->isSelected()) {
@@ -421,7 +421,7 @@ void AccelLineEdit::keyPressEvent (QKeyEvent * e)
}
// 4 keys are allowed for QShortcut
switch(keyPressedCount) {
switch (keyPressedCount) {
case 4:
keyPressedCount = 0;
txtLine.clear();
@@ -482,7 +482,7 @@ void ModifierLineEdit::keyPressEvent (QKeyEvent * e)
int key = e->key();
Qt::KeyboardModifiers state = e->modifiers();
switch(key) {
switch (key) {
case Qt::Key_Backspace:
case Qt::Key_Delete:
clear();

View File

@@ -103,10 +103,10 @@ private:
void setButtonsEnabled();
private Q_SLOTS:
void on_addButton_clicked();
void on_removeButton_clicked();
void on_upButton_clicked();
void on_downButton_clicked();
void onAddButtonClicked();
void onRemoveButtonClicked();
void onUpButtonClicked();
void onDownButtonClicked();
void onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
void onItemDoubleClicked(QTreeWidgetItem * item, int column);

View File

@@ -94,17 +94,17 @@ void finishDatumConstraint (Gui::Command* cmd, Sketcher::SketchObject* sketch, b
// Get the latest constraint
const std::vector<Sketcher::Constraint *> &ConStr = sketch->Constraints.getValues();
int lastConstraintIndex = ConStr.size() - 1;
auto lastConstraintIndex = ConStr.size() - 1;
Sketcher::Constraint *constr = ConStr[lastConstraintIndex];
auto lastConstraintType = constr->Type;
// Guess some reasonable distance for placing the datum text
Gui::Document *doc = cmd->getActiveGuiDocument();
float scaleFactor = 1.f;
float labelPosition = 0.f;
float labelPositionRandomness = 0.f;
float scaleFactor = 1.0;
double labelPosition = 0.0;
float labelPositionRandomness = 0.0;
if(lastConstraintType == Radius || lastConstraintType == Diameter) {
if (lastConstraintType == Radius || lastConstraintType == Diameter) {
labelPosition = hGrp->GetFloat("RadiusDiameterConstraintDisplayBaseAngle", 15.0) * (M_PI / 180); // Get radius/diameter constraint display angle
labelPositionRandomness = hGrp->GetFloat("RadiusDiameterConstraintDisplayAngleRandomness", 0.0) * (M_PI / 180); // Get randomness
@@ -1996,7 +1996,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg)
getIdsFromName(SubNames[i], Obj, GeoId2, PosId2);
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
if (areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2)) {
showNoConstraintBetweenFixedGeometry();
return;
}
@@ -2005,7 +2005,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg)
// arise and substitute them with more appropriate counterparts, examples:
// - coincidence + tangency on edge
// - point on object + tangency on edge
if(substituteConstraintCombinations(Obj, GeoId1, PosId1,GeoId2, PosId2)) {
if (substituteConstraintCombinations(Obj, GeoId1, PosId1,GeoId2, PosId2)) {
constraintsAdded = true;
break;
}
@@ -2045,7 +2045,7 @@ void CmdSketcherConstrainCoincident::applyConstraint(std::vector<SelIdPair> &sel
Sketcher::PointPos PosId1 = selSeq.at(0).PosId, PosId2 = selSeq.at(1).PosId;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj, GeoId1, GeoId2) ) {
if (areBothPointsOrSegmentsFixed(Obj, GeoId1, GeoId2)) {
showNoConstraintBetweenFixedGeometry();
return;
}