diff --git a/src/app/puzzle/layout/vpsheet.cpp b/src/app/puzzle/layout/vpsheet.cpp index 695419e2a..2fc8119ab 100644 --- a/src/app/puzzle/layout/vpsheet.cpp +++ b/src/app/puzzle/layout/vpsheet.cpp @@ -218,16 +218,16 @@ auto VPSheetSceneData::RotationControls() const -> VPGraphicsPieceControls * //--------------------------------------------------------------------------------------------------------------------- auto VPSheetSceneData::ScenePiece(const VPPiecePtr &piece) const -> VPGraphicsPiece * { - VPGraphicsPiece *_graphicsPiece = nullptr; - for(auto *graphicPiece : m_graphicsPieces) + auto _graphicsPiece = + std::find_if(m_graphicsPieces.begin(), m_graphicsPieces.end(), + [piece](VPGraphicsPiece *graphicPiece) { return graphicPiece->GetPiece() == piece; }); + + if (_graphicsPiece != m_graphicsPieces.end()) { - if(graphicPiece->GetPiece() == piece) - { - _graphicsPiece = graphicPiece; - } + return *_graphicsPiece; } - return _graphicsPiece; + return nullptr; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 900111ec3..ba8a8217d 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -1373,7 +1373,11 @@ QSharedPointer MainWindowsNoGUI::OpenMeasurementFile(const QStrin { qCCritical(vMainNoGUIWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - m->clear(); + if (not m.isNull()) + { + m->clear(); + } + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); diff --git a/src/libs/vmisc/projectversion.cpp b/src/libs/vmisc/projectversion.cpp index 9efa01602..4d07ed0e7 100644 --- a/src/libs/vmisc/projectversion.cpp +++ b/src/libs/vmisc/projectversion.cpp @@ -93,6 +93,7 @@ QString compilerString() { return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15)); } + return QLatin1String("MSVC "); #else return QStringLiteral(""); #endif diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp index 5e4731c4a..9879ab869 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp @@ -223,7 +223,8 @@ bool VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) c { if (QFile::exists(tmpUrl.toLocalFile())) { - tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); break; + tmpFileInfo = QFileInfo(tmpUrl.toLocalFile()); + break; } } diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.h b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.h index ef607f722..7dda267af 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.h +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundimagecontrols.h @@ -85,7 +85,7 @@ signals: public slots: void ActivateControls(const QUuid &id); - void DeactivateControls(QGraphicsItem* pItem); + void DeactivateControls(QGraphicsItem* item); void UpdateControls(); protected: diff --git a/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp b/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp index d4d44913e..ff66af95f 100644 --- a/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp +++ b/src/libs/vtools/tools/backgroundimage/vbackgroundimageitem.cpp @@ -452,7 +452,7 @@ void VBackgroundImageItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *even //--------------------------------------------------------------------------------------------------------------------- void VBackgroundImageItem::keyPressEvent(QKeyEvent *event) { - const int move = event->modifiers() & Qt::ShiftModifier ? 10 : 1; + const int move = (event->modifiers() & Qt::ShiftModifier) ? 10 : 1; if (event->key() == Qt::Key_Left) { TranslateImageOn(-move, 0); diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp index a5352a0c2..3c40e08b1 100644 --- a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp @@ -604,7 +604,7 @@ int FancyTabBar::CurrentIndex() const } //--------------------------------------------------------------------------------------------------------------------- -void FancyTabBar::SetTabToolTip(int index, QString toolTip) +void FancyTabBar::SetTabToolTip(int index, const QString &toolTip) { m_attachedTabs[index]->m_toolTip = toolTip; } @@ -628,7 +628,7 @@ QString FancyTabBar::TabText(int index) const } //--------------------------------------------------------------------------------------------------------------------- -void FancyTabBar::SetTabText(int index, QString text) +void FancyTabBar::SetTabText(int index, const QString &text) { m_attachedTabs.at(index)->m_text=text; setMaximumWidth(TabSizeHint(false).width()); diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.h b/src/libs/vwidgets/fancytabbar/fancytabbar.h index e696ab13c..373dd4b22 100644 --- a/src/libs/vwidgets/fancytabbar/fancytabbar.h +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.h @@ -69,13 +69,13 @@ public: void SetCurrentIndex(int index); int CurrentIndex() const; - void SetTabToolTip(int index, QString toolTip); + void SetTabToolTip(int index, const QString &toolTip); QString TabToolTip(int index) const; QIcon TabIcon(int index) const; QString TabText(int index) const; - void SetTabText(int index, QString text); + void SetTabText(int index, const QString &text); int Count() const; QRect TabRect(int index) const;