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
main.cpp
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
10#include <QAbstractItemModel>
11#include <QApplication>
12#include <QListView>
13
14#include "model.h"
15
17int main(int argc, char *argv[])
18{
19 QApplication app(argc, argv);
20
21// Unindented for quoting purposes:
23QStringList numbers;
24numbers << "One" << "Two" << "Three" << "Four" << "Five";
25
30view->setWindowTitle("View onto a string list model");
32view->setModel(model);
34
35 model->insertRows(5, 7, QModelIndex());
36
37 for (int row = 5; row < 12; ++row) {
40 }
41
43 view->show();
44 return app.exec();
45}
virtual Q_INVOKABLE bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the data in row and column with parent.
The QApplication class manages the GUI application's control flow and main settings.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
The QListView class provides a list or icon view onto a model.
Definition qlistview.h:17
\inmodule QtCore
\inmodule QtCore
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:8084
void show()
Shows the window.
Definition qwindow.cpp:2254
int main()
[0]
GLuint index
[2]
GLenum GLenum GLsizei void * row
QSqlQueryModel * model
[16]
QApplication app(argc, argv)
[0]
QQuickView * view
[0]