mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add data, row count and the string list that populate the model
I know that there is a QStringListModel, but that doesn't have add and remove methods, and thus I cannot use it. ;) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3d8e2d0643
commit
7bc93d4242
1 changed files with 11 additions and 2 deletions
|
@ -20,7 +20,9 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
|
|||
|
||||
ColumnNameProvider::ColumnNameProvider(QObject *parent)
|
||||
{
|
||||
|
||||
columnNames << tr("Dive #") << tr("Date") << tr("Time") << tr("Duration") << tr("Location") << tr("GPS") << tr("Weight") << tr("Cyl size") << tr("Start Pressure")
|
||||
<< tr("End Press") << tr("Max depth") << tr("Mean depth") << tr("Buddy") << tr("Notes") << tr("Tags") << tr("Air temp") << tr("Water temp")
|
||||
<< tr("O₂") << tr("He");
|
||||
}
|
||||
|
||||
bool ColumnNameProvider::insertRows(int row, int count, const QModelIndex &parent)
|
||||
|
@ -40,12 +42,19 @@ bool ColumnNameProvider::setData(const QModelIndex &index, const QVariant &value
|
|||
|
||||
QVariant ColumnNameProvider::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
return QVariant(columnNames[index.row()]);
|
||||
}
|
||||
|
||||
int ColumnNameProvider::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
|
||||
Q_UNUSED(parent)
|
||||
return columnNames.count();
|
||||
}
|
||||
|
||||
DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDialog(parent),
|
||||
|
|
Loading…
Reference in a new issue