According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
30 lines
896 B
C++
30 lines
896 B
C++
// Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
|
|
|
#include <QApplication>
|
|
#include <QStandardItemModel>
|
|
#include <QTableView>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QApplication app(argc, argv);
|
|
|
|
QStandardItemModel model(4, 4);
|
|
QTableView tableView;
|
|
tableView.setSizeAdjustPolicy(QTableView::AdjustToContents);
|
|
tableView.setModel(&model);
|
|
|
|
for (int row = 0; row < model.rowCount(); ++row) {
|
|
for (int column = 0; column < model.columnCount(); ++column) {
|
|
QModelIndex index = model.index(row, column, QModelIndex());
|
|
model.setData(index, QVariant(QString("%1,%2").arg(row).arg(column)));
|
|
}
|
|
}
|
|
|
|
tableView.setSpan(1, 1, 2, 2);
|
|
|
|
tableView.show();
|
|
|
|
return app.exec();
|
|
}
|