Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 <QAbstractTableModel>
8#include <QStringList>
9#include <QVariant>
10
12{
14
15public:
16 TableModel(int rows = 1, int columns = 1, QObject *parent = nullptr);
17
18 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
19 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
20 QVariant data(const QModelIndex &index, int role) const override;
21 QVariant headerData(int section, Qt::Orientation orientation,
22 int role = Qt::DisplayRole) const override;
23
24 Qt::ItemFlags flags(const QModelIndex &index) const override;
25 bool setData(const QModelIndex &index, const QVariant &value,
26 int role = Qt::EditRole) override;
27
28 bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override;
29 bool insertColumns(int position, int columns, const QModelIndex &parent = QModelIndex()) override;
30 bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override;
31 bool removeColumns(int position, int columns, const QModelIndex &parent = QModelIndex()) override;
32
33private:
34 QList<QStringList> rowList;
35};
36
37#endif
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qvariant.h:65
[0]
Definition model.h:12
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of items in the row list as the number of rows in the model.
Definition model.cpp:38
bool removeColumns(int position, int columns, const QModelIndex &parent=QModelIndex()) override
Removes a number of columns from the model at the specified position.
Definition model.cpp:187
bool insertRows(int position, int rows, const QModelIndex &parent=QModelIndex()) override
Inserts a number of rows into the model at the specified position.
Definition model.cpp:128
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Changes an item in the model, but only if the following conditions are met:
Definition model.cpp:113
bool removeRows(int position, int rows, const QModelIndex &parent=QModelIndex()) override
Removes a number of rows from the model at the specified position.
Definition model.cpp:170
TableModel(int rows=1, int columns=1, QObject *parent=nullptr)
Constructs a table model with at least one row and one column.
Definition model.cpp:18
bool insertColumns(int position, int columns, const QModelIndex &parent=QModelIndex()) override
Inserts a number of columns into the model at the specified position.
Definition model.cpp:150
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the appropriate header string depending on the orientation of the header and the section.
Definition model.cpp:78
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of items in the first list item as the number of columns in the model.
Definition model.cpp:48
Orientation
Definition qnamespace.h:98
@ EditRole
@ DisplayRole
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLbitfield flags
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_OBJECT