aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/randomsortmodel.h
blob: 9fae9b2b761feb415a0f22ebb7c6e68a79561f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef RANDOMSORTMODEL_H
#define RANDOMSORTMODEL_H

#include <QAbstractListModel>

class RandomSortModel : public QAbstractListModel
{
    Q_OBJECT

public:
    explicit RandomSortModel(QObject *parent = nullptr);
    QHash<int, QByteArray> roleNames() const override;

    QVariant data(const QModelIndex& index, int role) const override;
    int rowCount(const QModelIndex& parent = QModelIndex()) const override;

    void randomize();

  private:
    QList<QPair<QString, int> > mData;
};

#endif // RANDOMSORTMODEL_H