Sonar warnings.

develop
Roman Telezhynskyi 2024-02-17 16:46:59 +02:00
parent 3192b0cafa
commit 6d04cd32a7
7 changed files with 26 additions and 26 deletions

View File

@ -83,13 +83,13 @@ auto StrToGrainlineType(const QString &string) -> GrainlineType
return type;
}
#if __cplusplus < 202002L
//---------------------------------------------------------------------------------------------------------------------
auto VPTransformationOrigon::operator==(const VPTransformationOrigon &origin) const -> bool
{
return this->origin == origin.origin && custom == origin.custom;
return origin == origin.origin && custom == origin.custom;
}
#if __cplusplus < 202002L
//---------------------------------------------------------------------------------------------------------------------
auto VPTransformationOrigon::operator!=(const VPTransformationOrigon &origin) const -> bool
{

View File

@ -58,9 +58,10 @@ struct VPTransformationOrigon
QPointF origin{}; // NOLINT(misc-non-private-member-variables-in-classes)
bool custom{false}; // NOLINT(misc-non-private-member-variables-in-classes)
#if __cplusplus >= 202002L
auto operator==(const VPTransformationOrigon &origin) const -> bool = default;
#else
auto operator==(const VPTransformationOrigon &origin) const -> bool;
#if __cplusplus < 202002L
auto operator!=(const VPTransformationOrigon &origin) const -> bool;
#endif
};

View File

@ -56,6 +56,11 @@
#include "../vmisc/compatibility.h"
#endif
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
@ -66,11 +71,6 @@ Q_LOGGING_CATEGORY(pApp, "p.application") // NOLINT
QT_WARNING_POP
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif
//---------------------------------------------------------------------------------------------------------------------
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context,
const QString &msg) // NOLINT(readability-function-cognitive-complexity)

View File

@ -39,7 +39,7 @@ class QGraphicsScene;
class VCommonSettings;
class QPainter;
class VPTileFactory : QObject
class VPTileFactory : public QObject
{
Q_OBJECT // NOLINT

View File

@ -28,12 +28,11 @@
#ifndef UTILS_H
#define UTILS_H
#include <QtGlobal>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal>
class QMimeType;
class QString;
class QMimeType;
class QByteArray;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View File

@ -101,7 +101,7 @@ inline auto operator""_s(const char16_t *str, size_t size)Q_DECL_NOEXCEPT->QStri
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToList(const C<T> &container) -> QList<T>
{
return QList<T>(container.begin(), container.end());
return QList<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
@ -113,25 +113,25 @@ template <typename T, template <typename> class C> inline auto ConvertToStringLi
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToSet(const C<T> &container) -> QSet<T>
{
return QSet<T>(container.begin(), container.end());
return QSet<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename C> inline auto ConvertToSet(const C &container) -> QSet<T>
{
return QSet<T>(container.begin(), container.end());
return QSet<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToVector(const C<T> &container) -> QVector<T>
{
return QVector<T>(container.begin(), container.end());
return QVector<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline auto ConvertToVector(const QSet<T> &container) -> QVector<T>
{
return QVector<T>(container.begin(), container.end());
return QVector<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
@ -159,7 +159,7 @@ inline auto Reverse(const C<T> &container) -> C<T>
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename std::enable_if<std::is_same<T, QStringList>::value, T>::type * = nullptr>
template <typename T, std::enable_if_t<std::is_same_v<T, QStringList>, T> * = nullptr>
inline auto Reverse(const T &container) -> T
{
return Reverse<QString, QList>(container);

View File

@ -78,16 +78,16 @@ void VPE::VPropertyFormWidget::build()
{
// Clear the old content, delete old widgets
d_ptr->EditorWidgets.clear();
if (layout())
if (layout() != nullptr)
{
QLayoutItem *child;
while (layout()->count() > 0 && (child = layout()->takeAt(0)) != nullptr)
while (layout()->count() > 0)
{
if (child->widget())
QLayoutItem *child = layout()->takeAt(0);
if (child != nullptr)
{
delete child->widget();
delete child;
}
delete child;
}
delete layout();
}
@ -98,7 +98,7 @@ void VPE::VPropertyFormWidget::build()
return; //... only if there are properties
}
QFormLayout *tmpFormLayout = new QFormLayout(this);
auto *tmpFormLayout = new QFormLayout(this);
tmpFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(tmpFormLayout);
@ -116,10 +116,10 @@ void VPE::VPropertyFormWidget::build()
if (tmpProperty->propertyType() == Property::Complex)
{
buildEditor(tmpProperty, tmpFormLayout, Property::Complex);
QWidget *group = new QWidget(this);
auto *group = new QWidget(this);
tmpFormLayout->addRow(group);
QFormLayout *subFormLayout = new QFormLayout(group);
auto *subFormLayout = new QFormLayout(group);
subFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QMargins margins = subFormLayout->contentsMargins();
margins.setTop(0);