| 337 | } |
| 338 | |
| 339 | void InstanceView::mouseMoveEvent(QMouseEvent *event) |
| 340 | { |
| 341 | executeDelayedItemsLayout(); |
| 342 | |
| 343 | QPoint topLeft; |
| 344 | QPoint visualPos = event->pos(); |
| 345 | QPoint geometryPos = event->pos() + offset(); |
| 346 | |
| 347 | if (state() == ExpandingState || state() == CollapsingState) |
| 348 | { |
| 349 | return; |
| 350 | } |
| 351 | |
| 352 | if (state() == DraggingState) |
| 353 | { |
| 354 | topLeft = m_pressedPosition - offset(); |
| 355 | if ((topLeft - event->pos()).manhattanLength() > QApplication::startDragDistance()) |
| 356 | { |
| 357 | m_pressedIndex = QModelIndex(); |
| 358 | startDrag(model()->supportedDragActions()); |
| 359 | setState(NoState); |
| 360 | stopAutoScroll(); |
| 361 | } |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | if (selectionMode() != SingleSelection) |
| 366 | { |
| 367 | topLeft = m_pressedPosition - offset(); |
| 368 | } |
| 369 | else |
| 370 | { |
| 371 | topLeft = geometryPos; |
| 372 | } |
| 373 | |
| 374 | if (m_pressedIndex.isValid() && (state() != DragSelectingState) && |
| 375 | (event->buttons() != Qt::NoButton) && !selectedIndexes().isEmpty()) |
| 376 | { |
| 377 | setState(DraggingState); |
| 378 | return; |
| 379 | } |
| 380 | |
| 381 | if ((event->buttons() & Qt::LeftButton) && selectionModel()) |
| 382 | { |
| 383 | setState(DragSelectingState); |
| 384 | |
| 385 | setSelection(QRect(visualPos, visualPos), QItemSelectionModel::ClearAndSelect); |
| 386 | QModelIndex index = indexAt(visualPos); |
| 387 | |
| 388 | // set at the end because it might scroll the view |
| 389 | if (index.isValid() && (index != selectionModel()->currentIndex()) && |
| 390 | (index.flags() & Qt::ItemIsEnabled)) |
| 391 | { |
| 392 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 |
nothing calls this directly
no test coverage detected