Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qstringlistmodel.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSTRINGLISTMODEL_H
6#define QSTRINGLISTMODEL_H
7
8#include <QtCore/qabstractitemmodel.h>
9#include <QtCore/qstringlist.h>
10
12
14
15class Q_CORE_EXPORT QStringListModel : public QAbstractListModel
16{
17 Q_OBJECT
18public:
19 explicit QStringListModel(QObject *parent = nullptr);
20 explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr);
21
22 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
23 QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
24
25 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
26 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
27 bool clearItemData(const QModelIndex &index) override;
28
29 Qt::ItemFlags flags(const QModelIndex &index) const override;
30
31 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
32 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
33 bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
34
35 QMap<int, QVariant> itemData(const QModelIndex &index) const override;
36 bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
37
38 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
39
40 QStringList stringList() const;
41 void setStringList(const QStringList &strings);
42
43 Qt::DropActions supportedDropActions() const override;
44
45private:
46 Q_DISABLE_COPY(QStringListModel)
47 QStringList lst;
48};
49
50QT_END_NAMESPACE
51
52#endif // QSTRINGLISTMODEL_H
\inmodule QtCore
static bool ascendingLessThan(const std::pair< QString, int > &s1, const std::pair< QString, int > &s2)
static bool decendingLessThan(const std::pair< QString, int > &s1, const std::pair< QString, int > &s2)
QT_REQUIRE_CONFIG(stringlistmodel)