feat: basic geometry spreadsheet model
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user