#include <QApplication>
#include <QStandardItemModel>
#include <QTableView>
int main(int argc, char **argv)
{
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
model.setItem(row, column, item);
}
}
view1.setModel(&model);
view1.setColumnHidden(2, true); // only hidden in this view
view1.resize(800, 300);
view1.move(0, 0);
view1.show();
view2.setModel(&model);
view2.resize(800, 300);
view2.move(0, 320);
view2.show();
return app.exec();
}
#include <QApplication>
#include <QStandardItemModel>
#include <QTableView>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QStandardItemModel model(4, 4);
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
model.setItem(row, column, item);
}
}
QTableView view1;
view1.setModel(&model);
view1.setColumnHidden(2, true); // only hidden in this view
view1.resize(800, 300);
view1.move(0, 0);
view1.show();
QTableView view2;
view2.setModel(&model);
view2.resize(800, 300);
view2.move(0, 320);
view2.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks