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
model.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#ifndef MODEL_H
5#define MODEL_H
6
7#include <QAbstractListModel>
8#include <QObject>
9#include <QStringList>
10
11//! [0]
13{
15
16public:
19
20 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
21 QVariant data(const QModelIndex &index, int role) const override;
22 QVariant headerData(int section, Qt::Orientation orientation,
23//! [0] //! [1]
24 int role = Qt::DisplayRole) const override;
25//! [1]
26
27//! [2]
28 Qt::ItemFlags flags(const QModelIndex &index) const override;
29 bool setData(const QModelIndex &index, const QVariant &value,
30//! [2] //! [3]
31 int role = Qt::EditRole) override;
32//! [3]
33
34//! [4]
35 bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
36 bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
37//! [4]
38
39//! [5]
40private:
41 QStringList stringList;
42};
43//! [5]
44
45#endif
bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex()) override
[3]
Definition model.cpp:143
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
[3]
Definition model.cpp:124
QVariant data(const QModelIndex &index, int role) const override
[0]
Definition model.cpp:62
Qt::ItemFlags flags(const QModelIndex &index) const override
[1]
Definition model.cpp:103
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
[1]
Definition model.cpp:84
bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex()) override
[7]
Definition model.cpp:162
int main(int argc, char *argv[])
[ctor_close]