mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: use std::vector in struct device_table
Since we converted from QString to std::string, let's also use std::vector instead of QVector. We don't need COW semantics and all the rigmarole. Let's try to keep Qt data structures out of the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fd8bd9d5c7
commit
4a50badb57
4 changed files with 9 additions and 9 deletions
|
@ -11,7 +11,7 @@ DiveComputerModel::DiveComputerModel(QObject *parent) : CleanerTableModel(parent
|
|||
|
||||
QVariant DiveComputerModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.row() < 0 || index.row() >= dcs.size())
|
||||
if (index.row() < 0 || index.row() >= (int)dcs.size())
|
||||
return QVariant();
|
||||
const device &node = dcs[index.row()];
|
||||
|
||||
|
@ -55,7 +55,7 @@ Qt::ItemFlags DiveComputerModel::flags(const QModelIndex &index) const
|
|||
bool DiveComputerModel::setData(const QModelIndex &index, const QVariant &value, int)
|
||||
{
|
||||
// We should test if the role == Qt::EditRole
|
||||
if (index.row() < 0 || index.row() >= dcs.size())
|
||||
if (index.row() < 0 || index.row() >= (int)dcs.size())
|
||||
return false;
|
||||
|
||||
device &node = dcs[index.row()];
|
||||
|
@ -66,10 +66,10 @@ bool DiveComputerModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
|
||||
void DiveComputerModel::remove(const QModelIndex &index)
|
||||
{
|
||||
if (index.row() < 0 || index.row() >= dcs.size())
|
||||
if (index.row() < 0 || index.row() >= (int)dcs.size())
|
||||
return;
|
||||
beginRemoveRows(QModelIndex(), index.row(), index.row());
|
||||
dcs.remove(index.row());
|
||||
dcs.erase(dcs.begin() + index.row());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue