33 lines
864 B
C++
33 lines
864 B
C++
#include "Gui/GeometrySpreadsheetPanel/GeometrySpreadsheetModel.h"
|
|
|
|
int GeometrySpreadsheetModel::rowCount(const QModelIndex &parent) const
|
|
{
|
|
return stringList.count();
|
|
}
|
|
|
|
QVariant GeometrySpreadsheetModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (!index.isValid())
|
|
return QVariant();
|
|
|
|
if (index.row() >= stringList.size())
|
|
return QVariant();
|
|
|
|
if (role == Qt::DisplayRole)
|
|
return stringList.at(index.row());
|
|
else
|
|
return QVariant();
|
|
}
|
|
|
|
QVariant GeometrySpreadsheetModel::headerData(int section, Qt::Orientation orientation,
|
|
int role) const
|
|
{
|
|
if (role != Qt::DisplayRole)
|
|
return QVariant();
|
|
|
|
if (orientation == Qt::Horizontal)
|
|
return QStringLiteral("Column %1").arg(section);
|
|
else
|
|
return QStringLiteral("Row %1").arg(section);
|
|
}
|