- // Move the signals if we are dragging
- if (!_drag_traces.empty()) {
- const int delta = event->pos().y() - _mouse_down_point.y();
-
- for (std::list<std::pair<boost::weak_ptr<Trace>,
- int> >::iterator i = _drag_traces.begin();
- i != _drag_traces.end(); i++) {
- const boost::shared_ptr<Trace> trace((*i).first);
- if (trace) {
- const int y = (*i).second + delta;
- const int y_snap =
- ((y + View::SignalSnapGridSize / 2) /
- View::SignalSnapGridSize) *
- View::SignalSnapGridSize;
- trace->set_v_offset(y_snap);
-
- // Ensure the trace is selected
- trace->select();
- }
-
- }
+ if (!(event->buttons() & Qt::LeftButton))
+ return;
+
+ if ((event->pos() - _mouse_down_point).manhattanLength() <
+ QApplication::startDragDistance())
+ return;
+
+ // Check the list of dragging items is not empty
+ if (_drag_row_items.empty())
+ return;
+
+ // Check all the drag items share a common owner
+ const shared_ptr<RowItem> first_row_item(
+ _drag_row_items.front().first);
+ for (const auto &r : _drag_row_items) {
+ const shared_ptr<RowItem> row_item(r.first);
+ assert(row_item);