mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Dive d/l selection UI: Add the setData method
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
55cc16d77d
commit
797bf49129
2 changed files with 16 additions and 0 deletions
|
@ -539,6 +539,21 @@ QVariant DiveImportedModel::data(const QModelIndex& index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
|
||||
if (index.row() + firstIndex > lastIndex)
|
||||
return false;
|
||||
|
||||
if (role != Qt::CheckStateRole)
|
||||
return false;
|
||||
|
||||
checkStates[index.row() + firstIndex ] = value.toBool();
|
||||
dataChanged(index, index, QVector<int>() << Qt::CheckStateRole);
|
||||
}
|
||||
|
||||
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
int columnCount(const QModelIndex& index = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex& index = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex& index, int role) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
void setImportedDivesIndexes(int first, int last);
|
||||
private:
|
||||
int firstIndex;
|
||||
|
|
Loading…
Reference in a new issue