MCPcopy Create free account
hub / github.com/clementgallet/libTAS / dropMimeData

Method dropMimeData

src/program/ui/RamWatchModel.cpp:208–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208bool 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
236void RamWatchModel::saveSettings(QSettings& watchSettings)
237{

Callers

nothing calls this directly

Calls 2

isValidMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected