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
@ -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…
x
Reference in New Issue
Block a user