void SMLConnector::mousePress( QMouseEvent *e ) { if(e->button() == RightButton) { return; } if( startRubberBanding( e ) ) { m_mode = stmDrawRubber; } }
void ConnectorTool::mousePress( QMouseEvent *e ) { if(e->button() == LeftButton) { bool ok = true; if(!m_pStencil || (m_type == StraightConnector)) { ok = startRubberBanding(e); } else { if(m_pStencil) { Kivio::PolyLineConnector* connector = static_cast<Kivio::PolyLineConnector*>(m_pStencil); KivioCanvas* canvas = view()->canvasWidget(); KivioPage* pPage = canvas->activePage(); bool hit = false; KoPoint point = pPage->snapToTarget(canvas->mapFromScreen(e->pos()), 8.0, hit); if(!hit) { point = canvas->snapToGrid(startPoint); } if((m_mode == stmDrawRubber) && hit) { endRubberBanding(e); } else { connector->addPoint(point); } } } if(ok) { m_mode = stmDrawRubber; } else { m_mode = stmNone; } } else if(e->button() == RightButton) { if(m_type == PolyLineConnector) { if(m_mode == stmDrawRubber) { endRubberBanding(e); } view()->canvasWidget()->setCursor(*m_pConnectorCursor1); m_mode = stmNone; } } }
void SelectTool::mousePress(const QPoint &pos) { // Last point is used for undrawing at the last position and calculating the distance the mouse has moved m_lastPoint = view()->canvasWidget()->mapFromScreen(pos); m_origPoint = m_lastPoint; // Check if we nailed a custom drag point on a selected stencil if( startCustomDragging(pos, true) ) { m_mode = stmCustomDragging; return; } // Check if we are resizing if( startResizing(pos) ) { m_mode = stmResizing; return; } // Check if we nailed a custom drag point on any other stencil if( startCustomDragging(pos, false) ) { m_mode = stmCustomDragging; return; } // Check if we can drag a stencil if( startDragging(pos, false) ) { m_mode = stmDragging; return; } // This should always be the last 'start' call since it always returns true if( startRubberBanding(pos) ) { m_mode = stmDrawRubber; return; } }