cleanup QSortFilterProxyModel tests

Cleanup QSortFilterProxyModel tests:
 - adjust includes
 - use nullptr
 - use override
 - avoid unneeded casts
 - use new signal/slot syntax

Change-Id: I05f7c18cd2642bc8251bf1560803e7635684d24d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-10-19 18:01:08 +02:00
parent 31cbda4833
commit 9ae0fa4d49
3 changed files with 249 additions and 311 deletions

View File

@ -29,19 +29,10 @@
#ifndef TST_QSORTFILTERPROXYMODEL_H #ifndef TST_QSORTFILTERPROXYMODEL_H
#define TST_QSORTFILTERPROXYMODEL_H #define TST_QSORTFILTERPROXYMODEL_H
#include <QtTest/QtTest>
#include "dynamictreemodel.h" #include "dynamictreemodel.h"
#include <QLoggingCategory>
#include <QtCore/QCoreApplication> #include <QSortFilterProxyModel>
#include <QtGui/QStandardItem> #include <QStandardItemModel>
#include <QtWidgets/QTreeView>
#include <QtWidgets/QTableView>
#include <qdebug.h>
typedef QList<int> IntList;
typedef QPair<int, int> IntPair;
typedef QList<IntPair> IntPairList;
enum class FilterType { enum class FilterType {
RegExp, RegExp,
@ -53,10 +44,6 @@ Q_DECLARE_METATYPE(QList<QPersistentModelIndex>)
class tst_QSortFilterProxyModel : public QObject class tst_QSortFilterProxyModel : public QObject
{ {
Q_OBJECT Q_OBJECT
public:
tst_QSortFilterProxyModel();
public slots: public slots:
void initTestCase(); void initTestCase();
void cleanupTestCase(); void cleanupTestCase();
@ -181,8 +168,8 @@ protected:
FilterType m_filterType; FilterType m_filterType;
private: private:
QStandardItemModel *m_model; QStandardItemModel *m_model = nullptr;
QSortFilterProxyModel *m_proxy; QSortFilterProxyModel *m_proxy = nullptr;
}; };
Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint) Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint)

View File

@ -28,9 +28,8 @@
#include <QTest> #include <QTest>
#include <QSignalSpy> #include <QSignalSpy>
#include <QSortFilterProxyModel>
#include <QtCore/QSortFilterProxyModel> #include <QStandardItem>
#include <QtGui/QStandardItem>
Q_DECLARE_METATYPE(QModelIndex) Q_DECLARE_METATYPE(QModelIndex)