@@ -321,19 +321,36 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const | |||||
321 | { |
|
321 | { | |
322 | auto mimeData = new QMimeData; |
|
322 | auto mimeData = new QMimeData; | |
323 |
|
323 | |||
|
324 | bool isFirst = true; | |||
|
325 | ||||
324 | QVector<std::shared_ptr<DBEvent> > eventList; |
|
326 | QVector<std::shared_ptr<DBEvent> > eventList; | |
|
327 | QVector<std::shared_ptr<DBEventProduct> > eventProductList; | |||
325 |
|
328 | |||
326 | SqpRange firstTimeRange; |
|
329 | SqpRange firstTimeRange; | |
327 | for (const auto &index : indexes) { |
|
330 | for (const auto &index : indexes) { | |
328 | if (index.column() == 0) { // only the first column |
|
331 | if (index.column() == 0) { // only the first column | |
|
332 | ||||
|
333 | auto type = itemTypeOf(index); | |||
|
334 | if (type == ItemType::Event) { | |||
329 | auto event = getEvent(index); |
|
335 | auto event = getEvent(index); | |
330 |
|
|
336 | eventList << event; | |
331 | // Gets the range of the first variable |
|
337 | ||
|
338 | if (isFirst) { | |||
|
339 | isFirst = false; | |||
332 | // firstTimeRange.m_TStart = event->getTStart(); |
|
340 | // firstTimeRange.m_TStart = event->getTStart(); | |
333 | // firstTimeRange.m_TEnd = event->getTEnd(); |
|
341 | // firstTimeRange.m_TEnd = event->getTEnd(); | |
334 | } |
|
342 | } | |
|
343 | } | |||
|
344 | else if (type == ItemType::EventProduct) { | |||
|
345 | auto product = getEventProduct(index); | |||
|
346 | eventProductList << product; | |||
335 |
|
347 | |||
336 | eventList << event; |
|
348 | if (isFirst) { | |
|
349 | isFirst = false; | |||
|
350 | firstTimeRange.m_TStart = product->getTStart(); | |||
|
351 | firstTimeRange.m_TEnd = product->getTEnd(); | |||
|
352 | } | |||
|
353 | } | |||
337 | } |
|
354 | } | |
338 | } |
|
355 | } | |
339 |
|
356 | |||
@@ -341,7 +358,7 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const | |||||
341 | = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO |
|
358 | = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO | |
342 | mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData); |
|
359 | mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData); | |
343 |
|
360 | |||
344 | if (eventList.count() == 1) { |
|
361 | if (eventList.count() + eventProductList.count() == 1) { | |
345 | // No time range MIME data if multiple events are dragged |
|
362 | // No time range MIME data if multiple events are dragged | |
346 | auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange); |
|
363 | auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange); | |
347 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData); |
|
364 | mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData); |
General Comments 0
You need to be logged in to leave comments.
Login now