|
Krita Source Code Documentation
|
#include <kis_tool_measure.h>
Inheritance diagram for KisToolMeasure:Signals | |
| void | sigAngleChanged (double angle) |
| void | sigDistanceChanged (double distance) |
Signals inherited from KisTool | |
| void | isActiveChanged (bool isActivated) |
Signals inherited from KoToolBase | |
| void | activateTool (const QString &id) |
| void | cursorChanged (const QCursor &cursor) |
| void | selectionChanged (bool hasSelection) |
| void | statusTextChanged (const QString &statusText) |
| void | textModeChanged (bool inTextMode) |
Public Member Functions | |
| void | beginPrimaryAction (KoPointerEvent *event) override |
| void | continuePrimaryAction (KoPointerEvent *event) override |
| QWidget * | createOptionWidget () override |
| void | endPrimaryAction (KoPointerEvent *event) override |
| KisToolMeasure (KoCanvasBase *canvas) | |
| QPointF | lockedAngle (QPointF pos) |
| void | paint (QPainter &gc, const KoViewConverter &converter) override |
| void | showDistanceAngleOnCanvas () |
| ~KisToolMeasure () override | |
Public Member Functions inherited from KisTool | |
| virtual void | activateAlternateAction (AlternateAction action) |
| virtual void | activatePrimaryAction () |
| virtual bool | alternateActionSupportsHiResEvents (AlternateAction action) const |
| virtual void | beginAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | beginAlternateDoubleClickAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | beginPrimaryDoubleClickAction (KoPointerEvent *event) |
| virtual void | continueAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | deactivateAlternateAction (AlternateAction action) |
| virtual void | deactivatePrimaryAction () |
| void | deleteSelection () override |
| virtual void | endAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual int | flags () const |
| bool | isActive () const |
| KisTool (KoCanvasBase *canvas, const QCursor &cursor) | |
| void | mouseDoubleClickEvent (KoPointerEvent *event) override |
| void | mouseMoveEvent (KoPointerEvent *event) override |
| void | mousePressEvent (KoPointerEvent *event) override |
| void | mouseReleaseEvent (KoPointerEvent *event) override |
| void | mouseTripleClickEvent (KoPointerEvent *event) override |
| virtual void | newActivationWithExternalSource (KisPaintDeviceSP externalSource) |
| newActivationWithExternalSource Makes sure that the tool is active and starts a new stroke, which will be able to access the pixels from the specified external source. | |
| KisTool::NodePaintAbility | nodePaintAbility () |
| virtual bool | primaryActionSupportsHiResEvents () const |
| virtual bool | supportsPaintingAssistants () const |
| ~KisTool () override | |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Member Functions inherited from KoToolBase | |
| QAction * | action (const QString &name) const |
| KoCanvasBase * | canvas () const |
| Returns the canvas the tool is working on. | |
| virtual void | copy () const |
| QCursor | cursor () const |
| return the last emitted cursor | |
| virtual void | customMoveEvent (KoPointerEvent *event) |
| virtual void | customPressEvent (KoPointerEvent *event) |
| virtual void | customReleaseEvent (KoPointerEvent *event) |
| virtual void | cut () |
| virtual QRectF | decorationsRect () const |
| int | decorationThickness () const |
| decorationThickness The minimum thickness for tool decoration lines, this is derived from the screen magnification, thus the HiDPI settings. Note: to use this effectively, also set the pen to isCosmetic(true); | |
| virtual void | deselect () |
| deselect the tool should clear the selection if it has one. | |
| virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
| virtual void | dragMoveEvent (QDragMoveEvent *event, const QPointF &point) |
| virtual void | dropEvent (QDropEvent *event, const QPointF &point) |
| virtual void | explicitUserStrokeEndRequest () |
| explicitUserStrokeEndRequest is called by the input manager when the user presses Enter key or any equivalent. This callback comes before requestStrokeEnd(), which comes from a different source. | |
| KoToolFactoryBase * | factory () const |
| virtual void | focusInEvent (QFocusEvent *event) |
| virtual void | focusOutEvent (QFocusEvent *event) |
| virtual bool | hasSelection () |
| virtual void | inputMethodEvent (QInputMethodEvent *event) |
| virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
| bool | isInTextMode () const |
| bool | isOpacityPresetMode () const |
| virtual void | keyPressEvent (QKeyEvent *event) |
| virtual void | keyReleaseEvent (QKeyEvent *event) |
| KoToolBase (KoCanvasBase *canvas) | |
| bool | maskSyntheticEvents () const |
| QList< QPointer< QWidget > > | optionWidgets () |
| virtual bool | paste () |
| virtual QMenu * | popupActionsMenu () |
| virtual KisPopupWidgetInterface * | popupWidget () |
| virtual bool | selectAll () |
| selectAll select all data the tool can select. | |
| virtual KoToolSelection * | selection () |
| Q_INVOKABLE QString | toolId () const |
| virtual bool | wantsAutoScroll () const |
| ~KoToolBase () override | |
Private Member Functions | |
| double | angle () |
| QRectF | boundingRect () |
| double | distance () |
Private Attributes | |
| QVector2D | m_baseLineVec {QPointF(1, 0)} |
| bool | m_chooseBaseLineVec {false} |
| QPointF | m_endPos {QPointF(0, 0)} |
| KisToolMeasureOptionsWidget * | m_optionsWidget {nullptr} |
| QPointF | m_startPos {QPointF(0, 0)} |
Additional Inherited Members | |
Public Types inherited from KisTool | |
| enum | { FLAG_USES_CUSTOM_PRESET =0x01 , FLAG_USES_CUSTOM_COMPOSITEOP =0x02 , FLAG_USES_CUSTOM_SIZE =0x04 } |
| enum | AlternateAction { ChangeSize = AlternateChangeSize , ChangeSizeSnap = AlternateChangeSizeSnap , SampleFgNode = AlternateSampleFgNode , SampleBgNode = AlternateSampleBgNode , SampleFgImage = AlternateSampleFgImage , SampleBgImage = AlternateSampleBgImage , Secondary = AlternateSecondary , Third = AlternateThird , Fourth = AlternateFourth , Fifth = AlternateFifth , NONE = 10000 } |
| enum | NodePaintAbility { VECTOR , CLONE , PAINT , UNPAINTABLE , MYPAINTBRUSH_UNPAINTABLE } |
| enum | ToolAction { Primary , AlternateChangeSize , AlternateChangeSizeSnap , AlternateSampleFgNode , AlternateSampleBgNode , AlternateSampleFgImage , AlternateSampleBgImage , AlternateSecondary , AlternateThird , AlternateFourth , AlternateFifth , Alternate_NONE = 10000 } |
Public Slots inherited from KisTool | |
| void | activate (const QSet< KoShape * > &shapes) override |
| void | canvasResourceChanged (int key, const QVariant &res) override |
| void | deactivate () override |
| virtual void | updateSettingsViews () |
Public Slots inherited from KoToolBase | |
| virtual void | activate (const QSet< KoShape * > &shapes) |
| virtual void | canvasResourceChanged (int key, const QVariant &res) |
| virtual void | deactivate () |
| virtual void | documentResourceChanged (int key, const QVariant &res) |
| virtual void | repaintDecorations () |
| virtual void | requestRedoDuringStroke () |
| virtual void | requestStrokeCancellation () |
| virtual void | requestStrokeEnd () |
| virtual void | requestUndoDuringStroke () |
| void | setStatusText (const QString &statusText) |
| void | updateOptionsWidgetIcons () |
Static Public Member Functions inherited from KisTool | |
| static AlternateAction | actionToAlternateAction (ToolAction action) |
Public Attributes inherited from KisTool | |
| KoColor | currentBgColor |
| float | currentExposure {1.0} |
| KoColor | currentFgColor |
| KisFilterConfigurationSP | currentGenerator |
| KoAbstractGradientSP | currentGradient |
| KoPatternSP | currentPattern |
| QCursor | cursor |
| bool | m_isActive {false} |
| ToolMode | m_mode {HOVER_MODE} |
| QWidget * | optionWidget {0} |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Protected Types inherited from KisTool | |
| enum | ToolMode : int { HOVER_MODE , PAINT_MODE , SECONDARY_PAINT_MODE , MIRROR_AXIS_SETUP_MODE , GESTURE_MODE , PAN_MODE , OTHER , OTHER_1 } |
Protected Slots inherited from KisTool | |
| virtual void | resetCursorStyle () |
Protected Member Functions inherited from KisTool | |
| bool | blockUntilOperationsFinished () |
| void | blockUntilOperationsFinishedForced () |
| QPointF | convertDocumentToWidget (const QPointF &pt) |
| QPoint | convertToImagePixelCoordFloored (KoPointerEvent *e) |
| QPointF | convertToPixelCoord (const QPointF &pt) |
| QPointF | convertToPixelCoord (KoPointerEvent *e) |
| QPointF | convertToPixelCoordAndAlignOnWidget (const QPointF &pt) |
| QPointF | convertToPixelCoordAndSnap (const QPointF &pt, const QPointF &offset=QPointF()) |
| QPointF | convertToPixelCoordAndSnap (KoPointerEvent *e, const QPointF &offset=QPointF(), bool useModifiers=true) |
| QRectF | convertToPt (const QRectF &rect) |
| qreal | convertToPt (qreal value) |
| KoColor | currentBgColor () |
| KoColor | currentFgColor () |
| KisFilterConfigurationSP | currentGenerator () |
| KoAbstractGradientSP | currentGradient () |
| KisImageWSP | currentImage () |
| KisNodeSP | currentNode () const |
| KisPaintOpPresetSP | currentPaintOpPreset () |
| KoPatternSP | currentPattern () |
| QCursor | cursor () const |
| KisImageWSP | image () const |
| virtual bool | listeningToModifiers () |
| virtual void | listenToModifiers (bool listen) |
| virtual ToolMode | mode () const |
| bool | nodeEditable () |
| Checks checks if the current node is editable. | |
| bool | overrideCursorIfNotEditable () |
| Override the cursor appropriately if current node is not editable. | |
| void | paintToolOutline (QPainter *painter, const KisOptimizedBrushOutline &path) |
| KisOptimizedBrushOutline | pixelToView (const KisOptimizedBrushOutline &path) const |
| QPainterPath | pixelToView (const QPainterPath &pixelPath) const |
| Convert a pixel path into a view path. | |
| QPointF | pixelToView (const QPoint &pixelCoord) const |
| QPointF | pixelToView (const QPointF &pixelCoord) const |
| Convert a floating point pixel coordinate into a view coordinate. | |
| QPolygonF | pixelToView (const QPolygonF &pixelPolygon) const |
| Convert a pixel polygon into a view path. | |
| QRectF | pixelToView (const QRectF &pixelRect) const |
| Convert a pixel rectangle into a view rectangle. | |
| KisNodeList | selectedNodes () const |
| bool | selectionEditable () |
| Checks checks if the selection is editable, only applies to local selection as global selection is always editable. | |
| void | setCursor (const QCursor &cursor) |
| virtual void | setMode (ToolMode mode) |
| void | updateCanvasPixelRect (const QRectF &pixelRect) |
| Update the canvas for the given rectangle in image pixel coordinates. | |
| void | updateCanvasViewRect (const QRectF &viewRect) |
| Update the canvas for the given rectangle in view coordinates. | |
| QPointF | viewToPixel (const QPointF &viewCoord) const |
| QPointF | widgetCenterInWidgetPixels () |
Protected Member Functions inherited from KoToolBase | |
| virtual QList< QPointer< QWidget > > | createOptionWidgets () |
| int | grabSensitivity () const |
| Convenience function to get the current grab sensitivity. | |
| qreal | handleDocRadius () const |
| QRectF | handleGrabRect (const QPointF &position) const |
| QRectF | handlePaintRect (const QPointF &position) const |
| int | handleRadius () const |
| Convenience function to get the current handle radius. | |
| bool | isActivated () const |
| KoToolBase (KoToolBasePrivate &dd) | |
| KoPointerEvent * | lastDeliveredPointerEvent () const |
| void | setAbstractResource (KoAbstractCanvasResourceInterfaceSP abstractResource) |
| void | setConverter (KoDerivedResourceConverterSP converter) |
| void | setIsOpacityPresetMode (bool value) |
| void | setMaskSyntheticEvents (bool value) |
| void | setTextMode (bool value) |
| QHash< int, KoAbstractCanvasResourceInterfaceSP > | toolAbstractResources () |
| QHash< int, KoDerivedResourceConverterSP > | toolConverters () |
| void | useCursor (const QCursor &cursor) |
Protected Attributes inherited from KoToolBase | |
| KoToolBasePrivate * | d_ptr |
Properties inherited from KisTool | |
| bool | isActive |
Definition at line 55 of file kis_tool_measure.h.
| KisToolMeasure::KisToolMeasure | ( | KoCanvasBase * | canvas | ) |
Definition at line 99 of file kis_tool_measure.cc.
|
override |
Definition at line 104 of file kis_tool_measure.cc.
|
private |
Definition at line 257 of file kis_tool_measure.cc.
References m_baseLineVec, m_endPos, M_PI, and m_startPos.
|
overridevirtual |
Called by KisToolProxy when a primary action for the tool is started. The event stores the original event that started the stroke. The event is accepted by default. If the tool decides to ignore this particular action (e.g. when the node is not editable), it should call event->ignore(). Then no further continuePrimaryAction() or endPrimaryAction() will be called until the next user action.
Reimplemented from KisTool.
Definition at line 183 of file kis_tool_measure.cc.
References boundingRect(), Private::canvas, KisTool::convertToPixelCoord(), KisTool::convertToPt(), m_baseLineVec, m_endPos, m_startPos, KisTool::PAINT_MODE, KisTool::setMode(), sigAngleChanged(), sigDistanceChanged(), and KisCanvas2::updateCanvas().
|
private |
Definition at line 268 of file kis_tool_measure.cc.
References INNER_RADIUS, m_endPos, and m_startPos.
|
overridevirtual |
Called by KisToolProxy when the primary action is in progress of pointer movement. If the tool has ignored the event in beginPrimaryAction(), this method will not be called.
Reimplemented from KisTool.
Definition at line 198 of file kis_tool_measure.cc.
References angle(), boundingRect(), Private::canvas, CHECK_MODE_SANITY_OR_RETURN, KisTool::convertToPixelCoord(), KisTool::convertToPt(), distance(), lockedAngle(), m_baseLineVec, m_chooseBaseLineVec, m_endPos, m_startPos, KoPointerEvent::modifiers(), KisTool::PAINT_MODE, showDistanceAngleOnCanvas(), sigAngleChanged(), sigDistanceChanged(), and KisCanvas2::updateCanvas().
|
overridevirtual |
Reimplement this if your tool actually has an option widget. Sets the option widget to 0 by default.
Reimplemented from KisTool.
Definition at line 238 of file kis_tool_measure.cc.
References connect(), KisTool::currentImage(), m_optionsWidget, sigAngleChanged(), sigDistanceChanged(), and KoToolBase::toolId().
|
private |
Definition at line 263 of file kis_tool_measure.cc.
References m_endPos, and m_startPos.
|
overridevirtual |
Called by KisToolProxy when the primary action is being finished, that is while mouseRelease or tabletRelease event. If the tool has ignored the event in beginPrimaryAction(), this method will not be called.
Reimplemented from KisTool.
Definition at line 230 of file kis_tool_measure.cc.
References CHECK_MODE_SANITY_OR_RETURN, KisTool::HOVER_MODE, KisTool::PAINT_MODE, and KisTool::setMode().
| QPointF KisToolMeasure::lockedAngle | ( | QPointF | pos | ) |
Definition at line 107 of file kis_tool_measure.cc.
References M_PI, m_startPos, KisAlgebra2D::norm(), and normalizeAngle().
|
overridevirtual |
Called by the canvas to paint any decorations that the tool deems needed. The painter has the top left of the canvas as its origin.
| painter | used for painting the shape |
| converter | to convert between internal and view coordinates. |
Implements KoToolBase.
Definition at line 126 of file kis_tool_measure.cc.
References angle(), KisTool::currentImage(), distance(), INNER_RADIUS, m_baseLineVec, m_endPos, M_PI, m_startPos, KisTool::paintToolOutline(), and KoViewConverter::zoom().
| void KisToolMeasure::showDistanceAngleOnCanvas | ( | ) |
Definition at line 174 of file kis_tool_measure.cc.
References angle(), Private::canvas, KisFloatingMessage::High, KisToolMeasureOptionsWidget::m_distanceLabel, m_optionsWidget, KisToolMeasureOptionsWidget::m_unit, KisViewManager::showFloatingMessage(), KoUnit::symbol(), and KisCanvas2::viewManager().
|
signal |
|
signal |
|
private |
Definition at line 89 of file kis_tool_measure.h.
|
private |
Definition at line 90 of file kis_tool_measure.h.
|
private |
Definition at line 88 of file kis_tool_measure.h.
|
private |
Definition at line 85 of file kis_tool_measure.h.
|
private |
Definition at line 87 of file kis_tool_measure.h.