Posted by Noam Raphael on Mon 24 Dec 20:08
report abuse | download | new post
- #include <QString>
- #include <QApplication>
- #include <QTableView>
- #include "leak.h"
- QVariant TableModel::data(const QModelIndex &index, int) const
- {
- return QString("(%1, %2)").arg(index.row()).arg(index.column());
- }
- QVariant TableModel::headerData(int section, Qt::Orientation orientation, int role) const
- {
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
- return QString("%1").arg(section);
- if (orientation == Qt::Vertical && role == Qt::DisplayRole)
- return QString("%1").arg(section);
- return QVariant();
- }
- int main(int argc, char **argv)
- {
- QApplication app(argc, argv);
- TableModel *model = new TableModel;
- QTableView *tableView = new QTableView;
- tableView->setModel(model);
- tableView->show();
- return app.exec();
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.