lib
KoGuides Class Reference
List of all members.Detailed Description
Definition at line 36 of file KoGuides.h.
Public Types | |
typedef int | SnapStatus |
Public Slots | |
void | moveGuide (const QPoint &pos, bool horizontal, int rulerWidth) |
void | addGuide (const QPoint &pos, bool horizontal, int rulerWidth) |
Signals | |
void | guideLinesChanged (KoView *view) |
void | moveGuides (bool state) |
void | paintGuides (bool state) |
Public Member Functions | |
KoGuides (KoView *view, KoZoomHandler *zoomHandler) | |
~KoGuides () | |
void | paintGuides (QPainter &painter) |
bool | mousePressEvent (QMouseEvent *e) |
bool | mouseMoveEvent (QMouseEvent *e) |
bool | mouseReleaseEvent (QMouseEvent *e) |
bool | keyPressEvent (QKeyEvent *e) |
void | setGuideLines (const QValueList< double > &horizontalPos, const QValueList< double > &verticalPos) |
void | setAutoGuideLines (const QValueList< double > &horizontalPos, const QValueList< double > &verticalPos) |
void | getGuideLines (QValueList< double > &horizontalPos, QValueList< double > &verticalPos) const |
void | snapToGuideLines (KoRect &rect, int snap, SnapStatus &snapStatus, KoPoint &diff) |
void | snapToGuideLines (KoPoint &pos, int snap, SnapStatus &snapStatus, KoPoint &diff) |
void | repaintSnapping (const KoRect &snappedRect) |
void | repaintSnapping (const KoPoint &snappedPoint, SnapStatus snapStatus) |
void | repaintAfterSnapping () |
void | diffNextGuide (KoRect &rect, KoPoint &diff) |
Static Public Attributes | |
static const SnapStatus | SNAP_NONE = 0 |
static const SnapStatus | SNAP_HORIZ = 1 |
static const SnapStatus | SNAP_VERT = 2 |
static const SnapStatus | SNAP_BOTH = 3 |
Constructor & Destructor Documentation
KoGuides::KoGuides | ( | KoView * | view, | |
KoZoomHandler * | zoomHandler | |||
) |
Constructor.
- Parameters:
-
view The view in which the guides will be shown zoomHandler The zoom handler of the view
Definition at line 77 of file KoGuides.cpp.
KoGuides::~KoGuides | ( | ) |
Member Function Documentation
void KoGuides::addGuide | ( | const QPoint & | pos, | |
bool | horizontal, | |||
int | rulerWidth | |||
) | [slot] |
Add Guide.
This slot can be connected to void KoRuler::addGuide( const QPoint &, bool, int ); It will finish the inserting of a guide from moveGuide().
- Parameters:
-
pos The pos of the mouse horizontal true if the guide is horizontal, false if vertical rulerWidth The witdth of the ruler as the pos is seen from the ruler widget.
Definition at line 711 of file KoGuides.cpp.
Find the closesed disance to the next guide within the given distance.
- Parameters:
-
rect The rect which should be snapped diff distance in which too look for the closesed guide. The parameter is updated with the closesed distance to a guide if one is found (both in and out param)
Definition at line 614 of file KoGuides.cpp.
void KoGuides::getGuideLines | ( | QValueList< double > & | horizontalPos, | |
QValueList< double > & | verticalPos | |||
) | const |
Get the position of the guide lines.
This filles the passed lists with the positions of the guide lines. The lists will be emptied before any positions are added.
- Parameters:
-
horizontalPos A list of the position of the horizontal guide lines. verticalPos A list of the position of the vertical guide lines.
Definition at line 336 of file KoGuides.cpp.
void KoGuides::guideLinesChanged | ( | KoView * | view | ) | [signal] |
Signal that shows that the guide lines are changed.
This signal is emmited when the guide lines are changed ( moved / deleted )
- Parameters:
-
view The view in which the guide lines are changed.
bool KoGuides::keyPressEvent | ( | QKeyEvent * | e | ) |
- Parameters:
-
e QKeyEvent
- Returns:
- true if the event was handled
false otherwise
Definition at line 266 of file KoGuides.cpp.
bool KoGuides::mouseMoveEvent | ( | QMouseEvent * | e | ) |
Handle mouseMoveEvent.
If the mouse button is pressed and a guide was selected it moves the selected guides. If the mouse is moved over a guide line the cursor gets updated.
- Parameters:
-
e QMouseEvent
- Returns:
- true if the event was handled (guide moved, cursor changed as guide lies below)
false otherwise
Definition at line 203 of file KoGuides.cpp.
bool KoGuides::mousePressEvent | ( | QMouseEvent * | e | ) |
Handle mousePressEvent.
This checks if a mousePressEvent would affect a guide line. If the mouse is pressed over a guide line it gets selected. Guide lines which were select get unselect. If also the Ctrl Key is pressed the selection of the guide gets toggled. If no guide is under the position all guides get deselected.
- Parameters:
-
e QMouseEvent
- Returns:
- true if the event was handled
false otherwise The event counts a not handled when only guides where deselected.
Definition at line 130 of file KoGuides.cpp.
bool KoGuides::mouseReleaseEvent | ( | QMouseEvent * | e | ) |
- Parameters:
-
e QMouseEvent
- Returns:
- true if the event was handled
false otherwise
Definition at line 230 of file KoGuides.cpp.
void KoGuides::moveGuide | ( | const QPoint & | pos, | |
bool | horizontal, | |||
int | rulerWidth | |||
) | [slot] |
Move Guide.
This slot can be connected to void KoRuler::moveGuide( const QPoint &, bool, int ); It will add a new guide when you move from the ruler to the canvas. After that it moves the guide.
- Parameters:
-
pos The pos of the mouse horizontal true if the guide is horizontal, false if vertical rulerWidth The witdth of the ruler as the pos is seen from the ruler widget.
Definition at line 680 of file KoGuides.cpp.
void KoGuides::moveGuides | ( | bool | state | ) | [signal] |
This signal is emitted when guides start/stop moving.
- Parameters:
-
state true when starting moving guides, false when stopping.
void KoGuides::paintGuides | ( | bool | state | ) | [signal] |
This signal is emitted when guides start/stop painting.
With this signal it is possible to only repaint the guides in the paint method of the canvas. Just set/unset a flag when this signal is emmited. This signal is emitted before and after a repaint is done.
- Parameters:
-
state true when starting painting guides, false when stopping.
void KoGuides::paintGuides | ( | QPainter & | painter | ) |
Paint the guides.
- Parameters:
-
painter with which the guides are painted
Definition at line 92 of file KoGuides.cpp.
void KoGuides::repaintAfterSnapping | ( | ) |
repaint guides so none is snapped
This issues a paint request if any guides have changed snapping status. It also effectively un-snaps all since it doesn't take an argument
Definition at line 588 of file KoGuides.cpp.
void KoGuides::repaintSnapping | ( | const KoPoint & | snappedPoint, | |
SnapStatus | snapStatus | |||
) |
repaint guides if any changed snapping status
This issues a paint request if any guides have changed snapping status.
- Parameters:
-
snappedPoint the point after it has been snapped
Definition at line 533 of file KoGuides.cpp.
void KoGuides::repaintSnapping | ( | const KoRect & | snappedRect | ) |
repaint guides if any changed snapping status
This issues a paint request if any guides have changed snapping status.
- Parameters:
-
snappedRect the rect after it has been snapped
Definition at line 479 of file KoGuides.cpp.
void KoGuides::setAutoGuideLines | ( | const QValueList< double > & | horizontalPos, | |
const QValueList< double > & | verticalPos | |||
) |
Set the positions for snapping of auto guide lines.
This removes all existing auto guide lines and set up new ones at the positions given.
- Parameters:
-
horizontalPos A list of the position of the horizontal guide lines. verticalPos A list of the position of the vertical guide lines.
Definition at line 312 of file KoGuides.cpp.
void KoGuides::setGuideLines | ( | const QValueList< double > & | horizontalPos, | |
const QValueList< double > & | verticalPos | |||
) |
Set the guide lines.
This removes all existing guides and set up new ones at the positions given.
- Parameters:
-
horizontalPos A list of the position of the horizontal guide lines. verticalPos A list of the position of the vertical guide lines.
Definition at line 286 of file KoGuides.cpp.
void KoGuides::snapToGuideLines | ( | KoPoint & | pos, | |
int | snap, | |||
SnapStatus & | snapStatus, | |||
KoPoint & | diff | |||
) |
Snap rect to guidelines.
This looks fo a guide which is in reach for the guide as defined in snap.
- Parameters:
-
pos the position which should be snapped snap the distance wherein the guide should snap - but always snap if already snapped snapStatus if horiz,vert or both directions are snapped (both in and out param) diff distance away from guide. Only valid if status is snapping (both in and out param)
Definition at line 432 of file KoGuides.cpp.
void KoGuides::snapToGuideLines | ( | KoRect & | rect, | |
int | snap, | |||
SnapStatus & | snapStatus, | |||
KoPoint & | diff | |||
) |
Snap rect to guidelines.
This looks for a guide which is in reach for the guide as defined in snap. This method has the abillity to combine more calls. The snapStatus and diff args are both input and output. On first call you should set snapStatus to 0. The return value would then show in which directions it has snapped. If you combine several KoGuides you can let these output arguments be input for the next koGuide. That way you'll always catch the nearest guide.
- Parameters:
-
rect the rect which should be snapped snap the distance within the guide should snap - but always snap if already snapped snapStatus if horiz,vert or both directions are snapped (both in and out param). diff distance away from guide. Only valid if status is snapping (both in and out param)
Definition at line 368 of file KoGuides.cpp.
The documentation for this class was generated from the following files: