File indexing completed on 2025-01-18 10:07:38
0001
0002
0003
0004 #ifndef QSTRINGLISTMODEL_H
0005 #define QSTRINGLISTMODEL_H
0006
0007 #include <QtCore/qabstractitemmodel.h>
0008 #include <QtCore/qstringlist.h>
0009
0010 QT_REQUIRE_CONFIG(stringlistmodel);
0011
0012 QT_BEGIN_NAMESPACE
0013
0014 class Q_CORE_EXPORT QStringListModel : public QAbstractListModel
0015 {
0016 Q_OBJECT
0017 public:
0018 explicit QStringListModel(QObject *parent = nullptr);
0019 explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr);
0020
0021 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0022 QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
0023
0024 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0025 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
0026 bool clearItemData(const QModelIndex &index) override;
0027
0028 Qt::ItemFlags flags(const QModelIndex &index) const override;
0029
0030 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
0031 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
0032 bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
0033
0034 QMap<int, QVariant> itemData(const QModelIndex &index) const override;
0035 bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
0036
0037 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
0038
0039 QStringList stringList() const;
0040 void setStringList(const QStringList &strings);
0041
0042 Qt::DropActions supportedDropActions() const override;
0043
0044 private:
0045 Q_DISABLE_COPY(QStringListModel)
0046 QStringList lst;
0047 };
0048
0049 QT_END_NAMESPACE
0050
0051 #endif