|
Krita Source Code Documentation
|
#include <KoCanvasController.h>
Inheritance diagram for KoCanvasController:Public Member Functions | |
| KisKActionCollection * | actionCollection () const |
| virtual KoCanvasBase * | canvas () const |
| virtual QPointF | currentCursorPosition () const =0 |
| virtual void | ensureVisibleDoc (const QRectF &docRect, bool smooth)=0 |
| Scrolls the content of the canvas so that the given rect is visible. | |
| KoCanvasController (KisKActionCollection *actionCollection) | |
| virtual void | pan (const QPoint &distance)=0 |
| virtual void | panDown ()=0 |
| virtual void | panLeft ()=0 |
| virtual void | panRight ()=0 |
| virtual void | panUp ()=0 |
| virtual QPointF | preferredCenter () const =0 |
| Returns the currently set preferred center point in view coordinates (pixels) | |
| Private () | |
| virtual void | resetScrollBars ()=0 |
| virtual QPoint | scrollBarValue () const =0 |
| virtual void | setCanvas (KoCanvasBase *canvas)=0 |
| virtual void | setPreferredCenter (const QPointF &viewPoint)=0 |
| virtual void | setScrollBarValue (const QPoint &value)=0 |
| virtual void | setZoom (KoZoomMode::Mode mode, qreal zoom)=0 |
| virtual void | zoomIn ()=0 |
| virtual void | zoomIn (const KoViewTransformStillPoint &stillPoint)=0 |
zooms in keeping stillPoint not moved. | |
| virtual void | zoomOut ()=0 |
| virtual void | zoomOut (const KoViewTransformStillPoint &stillPoint)=0 |
zooms out keeping stillPoint not moved. | |
| virtual KoZoomState | zoomState () const =0 |
| virtual void | zoomTo (const QRect &rect)=0 |
| zoom so that rect is exactly visible (as close as possible) | |
| virtual | ~KoCanvasController () |
Public Attributes | |
| KisKActionCollection * | actionCollection |
| QPoint | documentOffset |
| QSizeF | documentSize |
| qreal | preferredCenterFractionX |
| qreal | preferredCenterFractionY |
| QPointer< KoCanvasControllerProxyObject > | proxyObject |
Protected Member Functions | |
| void | setDocumentOffset (const QPoint &offset) |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
KoCanvasController is the base class for wrappers around your canvas that provides scrolling and zooming for your canvas.
Flake does not provide a canvas, the application will have to implement a canvas themselves. You canvas can be QWidget-based or something we haven't invented yet – as long the class that holds the canvas implements KoCanvasController, tools, scrolling and zooming will work.
A KoCanvasController implementation acts as a decorator around the canvas widget and provides a way to scroll the canvas, allows the canvas to be centered in the viewArea and manages tool activation.
The using application can instantiate this class and add its canvas using the setCanvas() call. Which is designed so it can be called multiple times if you need to exchange one canvas widget for another, for instance, switching between a plain QWidget or a QOpenGLWidget.
There is one KoCanvasController per canvas in your application.
The canvas widget is at most as big as the viewport of the scroll area, and when the view on the document is near its edges, smaller. In your canvas widget code, you can find the right place in your document in view coordinates (pixels) by adding the documentOffset
Definition at line 14 of file KoCanvasController.cpp.
|
explicit |
Constructor.
| actionCollection | the action collection for this canvas |
Definition at line 31 of file KoCanvasController.cpp.
References actionCollection, d, and proxyObject.
|
virtual |
Definition at line 38 of file KoCanvasController.cpp.
References d, KoToolManager::instance(), proxyObject, and KoToolManager::removeCanvasController().
| KisKActionCollection * KoCanvasController::actionCollection | ( | ) | const |
Returns the action collection for the window
|
virtual |
Return the currently set canvas. The default implementation will return Null
Reimplemented in KoCanvasControllerWidget.
Definition at line 45 of file KoCanvasController.cpp.
|
pure virtual |
Implemented in KisCanvasController.
|
pure virtual |
Scrolls the content of the canvas so that the given rect is visible.
The rect is to be specified in document coordinates (points). The scrollbar positions are changed so that the centerpoint of the rectangle is centered if possible.
| rect | the rectangle to make visible |
| smooth | if true the viewport translation will make be just enough to ensure visibility, no more. |
Implemented in KisCanvasController.
|
pure virtual |
Move the canvas over the x and y distance of the parameter distance
| distance | the distance in view coordinates (pixels). A positive distance means moving the canvas up/left. |
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Move the canvas down. This behaves the same as
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Move the canvas to the left. This behaves the same as
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Move the canvas to the right. This behaves the same as
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Move the canvas up. This behaves the same as
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Returns the currently set preferred center point in view coordinates (pixels)
Implemented in KisCanvasController.
|
inline |
Definition at line 17 of file KoCanvasController.cpp.
|
pure virtual |
Update the range of scroll bars
Implemented in KisCanvasController.
|
pure virtual |
Get the position of the scrollbar
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Set the new canvas to be shown as a child Calling this will Q_EMIT canvasRemoved() if there was a canvas before, and will emit canvasSet() with the new canvas.
| canvas | the new canvas. The KoCanvasBase::canvas() will be called to retrieve the actual widget which will then be added as child of this one. |
Implemented in KisCanvasController, and KoCanvasControllerWidget.
|
protected |
|
pure virtual |
Sets the preferred center point in view coordinates (pixels).
| viewPoint | the new preferred center |
Implemented in KisCanvasController.
|
pure virtual |
Set the position of the scrollbar
| value | the new values of the scroll bars |
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Implemented in KoCanvasControllerWidget.
|
pure virtual |
Implemented in KisCanvasController.
|
pure virtual |
zooms in keeping stillPoint not moved.
Implemented in KisCanvasController.
|
pure virtual |
Implemented in KisCanvasController.
|
pure virtual |
zooms out keeping stillPoint not moved.
Implemented in KisCanvasController.
|
pure virtual |
Implemented in KisCanvasController.
|
pure virtual |
zoom so that rect is exactly visible (as close as possible)
The rect must be specified in widget coordinates. The scrollbar positions are changed so that the center of the rect becomes center if possible.
| rect | the rect in widget coordinates that should fit the view afterwards |
Implemented in KoCanvasControllerWidget.
| KisKActionCollection * KoCanvasController::actionCollection |
Definition at line 28 of file KoCanvasController.cpp.
|
private |
Definition at line 197 of file KoCanvasController.h.
| QPoint KoCanvasController::documentOffset |
Definition at line 25 of file KoCanvasController.cpp.
| QSizeF KoCanvasController::documentSize |
Definition at line 24 of file KoCanvasController.cpp.
| qreal KoCanvasController::preferredCenterFractionX |
Definition at line 26 of file KoCanvasController.cpp.
| qreal KoCanvasController::preferredCenterFractionY |
Definition at line 27 of file KoCanvasController.cpp.
| QPointer<KoCanvasControllerProxyObject> KoCanvasController::proxyObject |
Definition at line 65 of file KoCanvasController.h.