Index: sources/model/MListModel.cpp =================================================================== diff -u -r53f7433638ec721d4f687fe8a4ed5d98c03c2fe7 -rf433eeefae34530e7cc3dc4e5576e43729b236f2 --- sources/model/MListModel.cpp (.../MListModel.cpp) (revision 53f7433638ec721d4f687fe8a4ed5d98c03c2fe7) +++ sources/model/MListModel.cpp (.../MListModel.cpp) (revision f433eeefae34530e7cc3dc4e5576e43729b236f2) @@ -29,6 +29,27 @@ } /*! + * \brief Appends a row of data to the end of the model. + * \param[in] data The data to append. +*/ +void View::MListModel::appendRow(const QHash &vData) { + insertRow(rowCount(), vData); +} + +/*! + * \brief Inserts data into the model at a given row. + * \param[in] row The index where the data will be inserted. + * If row is less than 0, then data will be prepended to the model. + * If row is greater than or equal to rowCount(), then data will be appeneded to the model. + * \param[in] data The data to insert into the model. +*/ +void View::MListModel::insertRow(const int vRow, const QHash &vData) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + _data.insert(vRow, vData); + endInsertRows(); +} + +/*! * \brief Retrieve the data stored at the given index for the specified role. * \param[in] index Index of the data in the list model. * \param[in] role Role of the data to fetch. @@ -116,6 +137,16 @@ } /*! + * \brief Helper function of setData to update data in the model + * \param[in] vRow row of item to update value + * \param[in] value Value to update. + * \param[in] role The role of the data at the given index to set. + */ +void View::MListModel::updateData (const int vRow, const int vRole, const QVariant& vValue) { + setData(index(vRow,0), vValue, vRole); +} + +/*! * \brief Assignment operator * \return A reference to this object. */