| 206 | } |
| 207 | |
| 208 | bool RamWatchModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
| 209 | { |
| 210 | // check if the format is supported |
| 211 | if (!mimeData->hasFormat(mimeType)) |
| 212 | return false; |
| 213 | // only drop between items (just to be safe, given that dropping onto items is forbidden by our flags() implementation) |
| 214 | if (parent.isValid() && row == -1) |
| 215 | return false; |
| 216 | // drop into empty area = append |
| 217 | if (row == -1) |
| 218 | row = rowCount(parent); |
| 219 | |
| 220 | // decode data |
| 221 | const QByteArray encodedData = mimeData->data(mimeType); |
| 222 | QDataStream stream(encodedData); |
| 223 | if (stream.atEnd()) |
| 224 | return false; |
| 225 | |
| 226 | int minRow; |
| 227 | int count; |
| 228 | |
| 229 | stream >> minRow >> count; |
| 230 | moveRows(parent, minRow, count, parent, row); |
| 231 | |
| 232 | return false; // we handled the move, not just the insertion, so don't let the caller do |
| 233 | // the removal of the source rows |
| 234 | } |
| 235 | |
| 236 | void RamWatchModel::saveSettings(QSettings& watchSettings) |
| 237 | { |