# ipeqt::Canvas Class Reference
[Ipe Qt canvas]

A Qt widget that displays an Ipe document page. More...

`#include <ipeqtcanvas.h>`

List of all members.

## Classes

- struct Style

## Signals

- void wheelMoved (int degrees)
- void mouseAction (int button)
- void positionChanged ()
- void toolChanged (bool hasTool)

## Public Member Functions

- Canvas (QWidget *parent, Qt::WFlags f=0)
- ~Canvas ()
- void setPage (const Page *page, int view, const Cascade *sheet)
- void setFontPool (const FontPool *fontPool)
- Vector pan () const
- double zoom () const
- const Cascade * cascade () const
- Vector center () const
- Vector pos () const
- Vector unsnappedPos () const
- Vector globalPos () const
- Vector simpleSnapPos () const
- const Snap & snap () const
- Vector devToUser (const Vector &arg) const
- Vector userToDev (const Vector &arg) const
- void setCanvasStyle (const Style &style)
- void setPretty (bool pretty)
- void setPan (const Vector &v)
- void setZoom (double zoom)
- void setSnap (const Snap &s)
- void setDimmed (bool dimmed)
- void setAutoOrigin (const Vector &v)
- Matrix canvasTfm () const
- void computeFifi (double x, double y)
- void setFifiVisible (bool visible)
- void update ()
- void updateTool ()
- void setTool (Tool *tool)
- void finishTool ()

## Protected Member Functions

- virtual void paintEvent (QPaintEvent *ev)
- virtual void mousePressEvent (QMouseEvent *ev)
- virtual void mouseReleaseEvent (QMouseEvent *ev)
- virtual void mouseMoveEvent (QMouseEvent *ev)
- virtual void tabletEvent (QTabletEvent *ev)
- virtual void wheelEvent (QWheelEvent *ev)
- virtual void keyPressEvent (QKeyEvent *ev)
- virtual QSize sizeHint () const
- void drawPaper (cairo_t *cc)
- void drawFrame (cairo_t *cc)
- void drawAxes (cairo_t *cc)
- void drawGrid (cairo_t *cc)
- void drawObjects (cairo_t *cc)
- void drawTool (Painter &painter)
- bool snapToPaperAndFrame ()

## Protected Attributes

- Tool * iTool
- const Page * iPage
- int iView
- const Cascade * iCascade
- Style iStyle
- Vector iPan
- double iZoom
- Snap iSnap
- bool iDimmed
- bool iAutoSnap
- Vector iAutoOrigin
- bool iRepaintObjects
- int iWidth
- int iHeight
- cairo_surface_t * iSurface
- Vector iUnsnappedMousePos
- Vector iMousePos
- Vector iGlobalPos
- Vector iOldFifi
- bool iFifiVisible
- Fonts * iFonts

## Detailed Description

A Qt widget that displays an Ipe document page.

## Constructor & Destructor Documentation

Canvas::Canvas | ( | QWidget * | parent,
|  | Qt::WFlags | f = `0` |
| ) |  |  |

Construct a new canvas.

Canvas::~Canvas | ( |  | ) |

destructor.

## Member Function Documentation

void Canvas::setPage | ( | const Page * | page,
|  | int | view,
|  | const Cascade * | sheet |
| ) |  |  |

Set the page to be displayed.

Doesn't take ownership of any argument.

void Canvas::setFontPool | ( | const FontPool * | fontPool | ) |

set information about Latex fonts (from ipe::Document)

Vector ipeqt::Canvas::pan | ( |  | ) | const`[inline]`

Return current pan.

double ipeqt::Canvas::zoom | ( |  | ) | const`[inline]`

Return current zoom.

const Cascade* ipeqt::Canvas::cascade | ( |  | ) | const`[inline]`

Return current style sheet cascade.

Vector ipeqt::Canvas::center | ( |  | ) | const`[inline]`

Return center of canvas.

Vector ipeqt::Canvas::pos | ( |  | ) | const`[inline]`

Return last mouse position (snapped!) in user coordinates.

Vector ipeqt::Canvas::unsnappedPos | ( |  | ) | const`[inline]`

Return last unsnapped mouse position in user coordinates.

Vector ipeqt::Canvas::globalPos | ( |  | ) | const`[inline]`

Return global mouse position of last mouse press/release.

Vector Canvas::simpleSnapPos | ( |  | ) | const

Return snapped mouse position without angular snapping.

const Snap& ipeqt::Canvas::snap | ( |  | ) | const`[inline]`

Return current snapping information.

Vector Canvas::devToUser | ( | const Vector & | arg | ) | const

Convert canvas (device) coordinates to user coordinates.

Vector Canvas::userToDev | ( | const Vector & | arg | ) | const

Convert user coordinates to canvas (device) coordinates.

void Canvas::setCanvasStyle | ( | const Style & | style | ) |

Set style of canvas drawing.

Includes paper color, pretty text, and grid.

void Canvas::setPretty | ( | bool | pretty | ) |

Determine whether pretty display should be used.

In pretty display, no dashed lines are drawn around text objects, and if Latex font data is not available, no text is drawn at all.

void Canvas::setPan | ( | const Vector & | v | ) |

Set current pan position.

The pan position is the user coordinate that is displayed at the very center of the canvas.

void Canvas::setZoom | ( | double | zoom | ) |

Set current zoom factor.

The zoom factor maps user coordinates to screen pixel coordinates.

void Canvas::setSnap | ( | const Snap & | s | ) |

Set the snapping information.

void Canvas::setDimmed | ( | bool | dimmed | ) |

Dim whole canvas, except for the Tool.

This mode will be reset when the Tool finishes.

void Canvas::setAutoOrigin | ( | const Vector & | v | ) |

Enable automatic angular snapping with this origin.

Matrix Canvas::canvasTfm | ( |  | ) | const

Matrix mapping user coordinates to canvas coordinates.

void Canvas::computeFifi | ( | double | x,
|  | double | y |
| ) |  |  |

Stores the mouse position in iUnsnappedMousePos, computes Fifi if snapping is enabled, and stores snapped position in iMousePos.

void Canvas::setFifiVisible | ( | bool | visible | ) |

Set whether Fifi should be shown.

Fifi will only be shown if a snapping mode is active.

void Canvas::update | ( |  | ) |

Mark for update with redrawing of objects.

void Canvas::updateTool | ( |  | ) |

Mark for update with redrawing of tool only.

void Canvas::setTool | ( | Tool * | tool | ) |

Set a new tool.

Emits toolChanged() signal.

void Canvas::finishTool | ( |  | ) |

void ipeqt::Canvas::wheelMoved | ( | int | degrees | ) | `[signal]`

void ipeqt::Canvas::mouseAction | ( | int | button | ) | `[signal]`

void ipeqt::Canvas::positionChanged | ( |  | ) | `[signal]`

void ipeqt::Canvas::toolChanged | ( | bool | hasTool | ) | `[signal]`

void Canvas::paintEvent | ( | QPaintEvent * | ev | ) | `[protected, virtual]`

void Canvas::mousePressEvent | ( | QMouseEvent * | ev | ) | `[protected, virtual]`

void Canvas::mouseReleaseEvent | ( | QMouseEvent * | ev | ) | `[protected, virtual]`

void Canvas::mouseMoveEvent | ( | QMouseEvent * | ev | ) | `[protected, virtual]`

void Canvas::tabletEvent | ( | QTabletEvent * | ev | ) | `[protected, virtual]`

void Canvas::wheelEvent | ( | QWheelEvent * | ev | ) | `[protected, virtual]`

void Canvas::keyPressEvent | ( | QKeyEvent * | ev | ) | `[protected, virtual]`

QSize Canvas::sizeHint | ( |  | ) | const`[protected, virtual]`

void Canvas::drawPaper | ( | cairo_t * | cc | ) | `[protected]`

void Canvas::drawFrame | ( | cairo_t * | cc | ) | `[protected]`

void Canvas::drawAxes | ( | cairo_t * | cc | ) | `[protected]`

void Canvas::drawGrid | ( | cairo_t * | cc | ) | `[protected]`

void Canvas::drawObjects | ( | cairo_t * | cc | ) | `[protected]`

void Canvas::drawTool | ( | Painter & | painter | ) | `[protected]`

Draw the current canvas tool.

If no tool is set, it draws the selected objects.

bool Canvas::snapToPaperAndFrame | ( |  | ) | `[protected]`

## Member Data Documentation

Tool* ipeqt::Canvas::iTool`[protected]`

const Page* ipeqt::Canvas::iPage`[protected]`

int ipeqt::Canvas::iView`[protected]`

const Cascade* ipeqt::Canvas::iCascade`[protected]`

Style ipeqt::Canvas::iStyle`[protected]`

Vector ipeqt::Canvas::iPan`[protected]`

double ipeqt::Canvas::iZoom`[protected]`

Snap ipeqt::Canvas::iSnap`[protected]`

bool ipeqt::Canvas::iDimmed`[protected]`

bool ipeqt::Canvas::iAutoSnap`[protected]`

Vector ipeqt::Canvas::iAutoOrigin`[protected]`

bool ipeqt::Canvas::iRepaintObjects`[protected]`

int ipeqt::Canvas::iWidth`[protected]`

int ipeqt::Canvas::iHeight`[protected]`

cairo_surface_t* ipeqt::Canvas::iSurface`[protected]`

Vector ipeqt::Canvas::iUnsnappedMousePos`[protected]`

Vector ipeqt::Canvas::iMousePos`[protected]`

Vector ipeqt::Canvas::iGlobalPos`[protected]`

Vector ipeqt::Canvas::iOldFifi`[protected]`

bool ipeqt::Canvas::iFifiVisible`[protected]`

Fonts* ipeqt::Canvas::iFonts`[protected]`

The documentation for this class was generated from the following files:

- ipeqtcanvas.h
- ipeqtcanvas.cpp