diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-01-06 14:39:56 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-06 19:34:54 -0800 |
commit | 7bc93d424254e4d544eb828f2374c652382bda6b (patch) | |
tree | b41c64fea451c384a08556e590b05d7b4f49ad09 /qt-ui | |
parent | 3d8e2d06439bcf5ce0e66b2e28a437ebbb8c9968 (diff) | |
download | subsurface-7bc93d424254e4d544eb828f2374c652382bda6b.tar.gz |
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>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 69639e2ec..cff386404 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -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), |