aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-10-06 15:50:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-11 08:11:28 +0000
commit3c1ef7894ae3119da7d67f778b53a8f709583da1 (patch)
tree4ba2e27c7685c089ce5c4a009a3ecc3fc2cbba97
parent3d5fcd35102ef74352b101d5ac864fe105a5bc2d (diff)
pysidetest: Fix some static code analysis warnings
Change-Id: If0050eadfc36444300b61498e46034ad3b4c8cdd Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> (cherry picked from commit cb19608e2614e98139addebdd57ee3b924a52c30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 6682099e10112b42de0f58ec6d7d7f28b7727961)
-rw-r--r--sources/pyside6/tests/pysidetest/flagstest.h4
-rw-r--r--sources/pyside6/tests/pysidetest/hiddenobject.cpp2
-rw-r--r--sources/pyside6/tests/pysidetest/hiddenobject.h6
-rw-r--r--sources/pyside6/tests/pysidetest/testobject.h4
-rw-r--r--sources/pyside6/tests/pysidetest/testview.cpp2
-rw-r--r--sources/pyside6/tests/pysidetest/testview.h5
6 files changed, 13 insertions, 10 deletions
diff --git a/sources/pyside6/tests/pysidetest/flagstest.h b/sources/pyside6/tests/pysidetest/flagstest.h
index 9058561f6..b5c73c9bd 100644
--- a/sources/pyside6/tests/pysidetest/flagstest.h
+++ b/sources/pyside6/tests/pysidetest/flagstest.h
@@ -23,8 +23,10 @@ class PYSIDETEST_API ClassForEnum : public QObject
{
Q_OBJECT
public:
+ Q_DISABLE_COPY_MOVE(ClassForEnum)
+
ClassForEnum(FlagsNamespace::Options opt = FlagsNamespace::Option::NoOptions);
- virtual ~ClassForEnum();
+ virtual ~ClassForEnum() override;
};
} // namespace FlagsNamespace
diff --git a/sources/pyside6/tests/pysidetest/hiddenobject.cpp b/sources/pyside6/tests/pysidetest/hiddenobject.cpp
index bba0de2ee..d4feabb66 100644
--- a/sources/pyside6/tests/pysidetest/hiddenobject.cpp
+++ b/sources/pyside6/tests/pysidetest/hiddenobject.cpp
@@ -8,7 +8,7 @@ void HiddenObject::callMe()
m_called = true;
}
-bool HiddenObject::wasCalled()
+bool HiddenObject::wasCalled() const
{
return m_called;
}
diff --git a/sources/pyside6/tests/pysidetest/hiddenobject.h b/sources/pyside6/tests/pysidetest/hiddenobject.h
index e3d0abbef..f399be985 100644
--- a/sources/pyside6/tests/pysidetest/hiddenobject.h
+++ b/sources/pyside6/tests/pysidetest/hiddenobject.h
@@ -13,12 +13,12 @@ class HiddenObject : public QObject
{
Q_OBJECT
public:
- HiddenObject() : m_called(false) {}
+ HiddenObject() noexcept = default;
Q_INVOKABLE void callMe();
public Q_SLOTS:
- bool wasCalled();
+ bool wasCalled() const;
private:
- bool m_called;
+ bool m_called = false;
};
// Return a instance of HiddenObject
diff --git a/sources/pyside6/tests/pysidetest/testobject.h b/sources/pyside6/tests/pysidetest/testobject.h
index 359387730..d3f0b2018 100644
--- a/sources/pyside6/tests/pysidetest/testobject.h
+++ b/sources/pyside6/tests/pysidetest/testobject.h
@@ -29,10 +29,10 @@ class PYSIDETEST_API TestObject : public QObject
{
Q_OBJECT
public:
- static void createApp() { int argc=0; new QApplication(argc, 0); };
+ static void createApp() { int argc=0; new QApplication(argc, nullptr); };
static int checkType(const QVariant& var) { return var.metaType().id(); }
- TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
+ TestObject(int idValue, QObject* parent = nullptr) : QObject(parent), m_idValue(idValue) {}
int idValue() const { return m_idValue; }
static int staticMethodDouble(int value) { return value * 2; }
void addChild(QObject* c) { m_children.append(c); emit childrenChanged(m_children); }
diff --git a/sources/pyside6/tests/pysidetest/testview.cpp b/sources/pyside6/tests/pysidetest/testview.cpp
index ade60682f..362239112 100644
--- a/sources/pyside6/tests/pysidetest/testview.cpp
+++ b/sources/pyside6/tests/pysidetest/testview.cpp
@@ -18,7 +18,7 @@ TestView::getData()
QWidget*
TestView::getEditorWidgetFromItemDelegate() const
{
- if (!m_delegate)
+ if (m_delegate == nullptr)
return nullptr;
QModelIndex index;
diff --git a/sources/pyside6/tests/pysidetest/testview.h b/sources/pyside6/tests/pysidetest/testview.h
index ee9ca9ce0..746def83e 100644
--- a/sources/pyside6/tests/pysidetest/testview.h
+++ b/sources/pyside6/tests/pysidetest/testview.h
@@ -18,7 +18,8 @@ class PYSIDETEST_API TestView : public QObject
{
Q_OBJECT
public:
- TestView(QAbstractListModel* model, QObject* parent = 0) : QObject(parent), m_model(model) {}
+ TestView(QAbstractListModel* model, QObject* parent = nullptr) :
+ QObject(parent), m_model(model) {}
QAbstractListModel* model() { return m_model; }
QVariant getData();
@@ -27,7 +28,7 @@ public:
private:
QAbstractListModel* m_model;
- QAbstractItemDelegate* m_delegate;
+ QAbstractItemDelegate* m_delegate = nullptr;
};
#endif // TESTVIEW_H