void KisToolPan::adjustCursor() { QPoint pt = canvas()->canvasWidget()->mapFromGlobal(QCursor::pos()); if(m_rotationMode && isInCheckerArea(pt)) { useCursor(KisCursor::pointingHandCursor()); } else { useCursor(m_defaultCursor); } }
void KoZoomTool::updateCursor(bool swap) { bool setZoomInCursor = m_zoomInMode; if (swap) { setZoomInCursor = !setZoomInCursor; } if (setZoomInCursor) { useCursor(m_inCursor); } else { useCursor(m_outCursor); } }
void KoPanTool::activate(bool temporary) { if (m_controller == 0) emit done(); m_temporary = temporary; useCursor(QCursor(Qt::OpenHandCursor), true); }
void KoPanTool::mouseReleaseEvent(KoPointerEvent *event) { event->accept(); useCursor(QCursor(Qt::OpenHandCursor)); if (m_temporary) emit done(); }
foreach(KarbonPatternEditStrategyBase *strategy, m_strategies) { if (strategy->selectHandle(event->point, *canvas()->viewConverter())) { m_currentStrategy = strategy; m_currentStrategy->repaint(); useCursor(Qt::SizeAllCursor); break; } }
void KisToolMultihand::activateAxesPointModeSetup() { if (customUI->moveOriginButton->isChecked()){ m_setupAxesFlag = true; useCursor(KisCursor::crossCursor()); updateCanvas(); } else { finishAxesSetup(); } }
void KoCreatePathTool::activate(ToolActivation, const QSet<KoShape*> &) { Q_D(KoCreatePathTool); useCursor(Qt::ArrowCursor); // retrieve the actual global handle radius d->handleRadius = handleRadius(); // reset snap guide canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); canvas()->snapGuide()->reset(); }
void CommentTool::activate(KoToolBase::ToolActivation toolActivation, const QSet< KoShape* >& /*shapes*/) { const QCursor cursor(Qt::ArrowCursor); emit useCursor(cursor); QList<KoShape*> allShapes = m_canvas->shapeManager()->shapes(); foreach( KoShape* shape, allShapes ) { InitialsCommentShape* initialsShape = dynamic_cast<InitialsCommentShape*>(shape); if(initialsShape) { initialsShape->setSelectable(true); } }
bool GraphicsWindowQt::init() { QGLFormat format( QGLFormat::defaultFormat() ); format.setAlphaBufferSize( _traits->alpha ); format.setRedBufferSize( _traits->red ); format.setGreenBufferSize( _traits->green ); format.setBlueBufferSize( _traits->blue ); format.setDepthBufferSize( _traits->depth ); format.setStencilBufferSize( _traits->stencil ); format.setSampleBuffers( _traits->sampleBuffers ); format.setSamples( _traits->samples ); format.setAlpha( _traits->alpha>0 ); format.setDepth( _traits->depth>0 ); format.setStencil( _traits->stencil>0 ); format.setDoubleBuffer( _traits->doubleBuffer ); format.setSwapInterval( _traits->vsync ? 1 : 0 ); WindowData* windowData = _traits.get() ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : 0; _widget = windowData ? windowData->_widget : 0; if ( !_widget ) { GraphicsWindowQt* sharedContextQt = dynamic_cast<GraphicsWindowQt*>(_traits->sharedContext); QGLWidget* shareWidget = sharedContextQt ? sharedContextQt->getGraphWidget() : 0; Qt::WindowFlags flags = Qt::Window|Qt::CustomizeWindowHint;//|Qt::WindowStaysOnTopHint; if ( _traits->windowDecoration ) flags |= Qt::WindowTitleHint|Qt::WindowMinMaxButtonsHint|Qt::WindowSystemMenuHint; _widget = new GraphWidget( format, 0, shareWidget, flags ); } _widget->setWindowTitle( _traits->windowName.c_str() ); _widget->move( _traits->x, _traits->y ); if ( !_traits->supportsResize ) _widget->setFixedSize( _traits->width, _traits->height ); else _widget->resize( _traits->width, _traits->height ); _widget->setFocusPolicy( Qt::WheelFocus ); _widget->setGraphicsWindow( this ); useCursor( _traits->useCursor ); return true; }
void KoCreateShapesTool::activate(ToolActivation, const QSet<KoShape*> &) { useCursor(Qt::ArrowCursor); }
void KoPanTool::mousePressEvent(KoPointerEvent *event) { m_lastPosition = documentToViewport(event->point); event->accept(); useCursor(QCursor(Qt::ClosedHandCursor)); }
void ConnectionTool::mouseMoveEvent(KoPointerEvent *event) { if (m_currentStrategy) { repaintDecorations(); if (m_editMode != EditConnection && m_editMode != CreateConnection) { QPointF snappedPos = canvas()->snapGuide()->snap(event->point, event->modifiers()); m_currentStrategy->handleMouseMove(snappedPos, event->modifiers()); } else { m_currentStrategy->handleMouseMove(event->point, event->modifiers()); } repaintDecorations(); } else if (m_editMode == EditConnectionPoint) { KoShape *hoverShape = findNonConnectionShapeAtPosition(event->point);//TODO exclude connectors, need snap guide maybe? if (hoverShape) { m_currentShape = hoverShape; Q_ASSERT(m_currentShape); // check if we should highlight another connection point int handle = handleAtPoint(m_currentShape, event->point); if (handle >= 0) { setEditMode(m_editMode, m_currentShape, handle); useCursor(handle >= KoConnectionPoint::FirstCustomConnectionPoint ? Qt::SizeAllCursor : Qt::ArrowCursor); } else { updateStatusText(); useCursor(Qt::CrossCursor); } } else { m_currentShape = 0; useCursor(Qt::ArrowCursor); } } else if (m_editMode == EditConnection) { Q_ASSERT(m_currentShape); KoShape *hoverShape = findShapeAtPosition(event->point); // check if we should highlight another connection handle int handle = handleAtPoint(m_currentShape, event->point); setEditMode(m_editMode, m_currentShape, handle); if (m_activeHandle == KoConnectionShape::StartHandle || m_activeHandle == KoConnectionShape::EndHandle) { useCursor(Qt::SizeAllCursor); } else if (m_activeHandle >= KoConnectionShape::ControlHandle_1) { } else if (hoverShape && hoverShape != m_currentShape) { useCursor(Qt::PointingHandCursor); } else { useCursor(Qt::ArrowCursor); } } else {// Idle and no current strategy KoShape *hoverShape = findShapeAtPosition(event->point); int hoverHandle = -1; if (hoverShape) { KoConnectionShape * connectionShape = dynamic_cast<KoConnectionShape*>(hoverShape); if (!connectionShape) { QPointF snappedPos = canvas()->snapGuide()->snap(event->point, event->modifiers()); hoverHandle = handleAtPoint(hoverShape, snappedPos); setEditMode(hoverHandle >= 0 ? CreateConnection : Idle, hoverShape, hoverHandle); } useCursor(hoverHandle >= 0 ? m_connectCursor : Qt::PointingHandCursor); } else { useCursor(Qt::ArrowCursor); } } }
void KoCreateShapesTool::activate(bool) { useCursor(Qt::ArrowCursor, true); }