• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KigPainter Class Reference

#include <kigpainter.h>

Public Member Functions

 KigPainter (const ScreenInfo &r, QPaintDevice *device, const KigDocument &doc, bool needOverlay=true)
 
 ~KigPainter ()
 
const Rect boundingRect (const Rect &r, const QString &s, int f=0) const
 
const Rect boundingRect (const Coordinate &c, const QString &s, int f=0) const
 
void drawAngle (const Coordinate &point, double startangle, double angle, int radius)
 
void drawArc (const Coordinate &center, double radius, double startangle, double angle)
 
void drawArea (const std::vector< Coordinate > &pts, bool border=true)
 
void drawCircle (const Coordinate &center, double radius)
 
void drawCurve (const CurveImp *curve)
 
void drawFatPoint (const Coordinate &p)
 
void drawFilledRect (const QRect &)
 
void drawGrid (const CoordinateSystem &c, bool showGrid=true, bool showAxes=true)
 
void drawLine (const Coordinate &p1, const Coordinate &p2)
 
void drawLine (const LineData &d)
 
void drawObject (const ObjectHolder *o, bool sel)
 
void drawObjects (const std::vector< ObjectHolder * > &os, bool sel)
 
template<typename iter >
void drawObjects (iter begin, iter end, bool sel)
 
void drawPoint (const Coordinate &p)
 
void drawPolygon (const std::vector< QPoint > &pts, Qt::FillRule fillRule=Qt::OddEvenFill)
 
void drawPolygon (const std::vector< Coordinate > &pts, Qt::FillRule fillRule=Qt::OddEvenFill)
 
void drawRay (const Coordinate &a, const Coordinate &b)
 
void drawRay (const LineData &d)
 
void drawRect (const Rect &r)
 
void drawRect (const QRect &r)
 
void drawRightAngle (const Coordinate &point, double startangle, int diagonal)
 
void drawSegment (const Coordinate &from, const Coordinate &to)
 
void drawSegment (const LineData &d)
 
void drawSimpleText (const Coordinate &c, const QString &s)
 
void drawText (const Rect &r, const QString &s, int textFlags=0)
 
void drawText (const Coordinate &p, const QString &s, int textFlags=0)
 
void drawTextFrame (const Rect &frame, const QString &s, bool needframe)
 
void drawTextStd (const QPoint &p, const QString &s)
 
void drawVector (const Coordinate &a, const Coordinate &b)
 
Coordinate fromScreen (const QPoint &p) const
 
Rect fromScreen (const QRect &r) const
 
QColor getColor () const
 
bool getNightVision () const
 
const std::vector< QRect > & overlay ()
 
double pixelWidth ()
 
void setBrush (const QBrush &b)
 
void setBrushColor (const QColor &c)
 
void setBrushStyle (Qt::BrushStyle c)
 
void setColor (const QColor &c)
 
void setFont (const QFont &f)
 
void setPen (const QPen &p)
 
void setPointStyle (int p)
 
void setSelected (bool selected)
 
void setStyle (Qt::PenStyle c)
 
void setWholeWinOverlay ()
 
void setWidth (int c)
 
const Rect simpleBoundingRect (const Coordinate &c, const QString &s)
 
QPoint toScreen (const Coordinate &p) const
 
QRect toScreen (const Rect &r) const
 
QRect toScreenEnlarge (const Rect &r) const
 
Rect window ()
 

Protected Member Functions

void circleOverlay (const Coordinate &centre, double radius)
 
void circleOverlayRecurse (const Coordinate &centre, double radius, const Rect &currentRect)
 
double overlayRectSize ()
 
void pointOverlay (const Coordinate &p1)
 
void segmentOverlay (const Coordinate &p1, const Coordinate &p2)
 
void textOverlay (const QRect &r, const QString &s, int textFlags)
 
void unsetSelected ()
 

Protected Attributes

QColor brushColor
 
Qt::BrushStyle brushStyle
 
QColor color
 
const KigDocument & mdoc
 
bool mNeedOverlay
 
std::vector< QRect > mOverlay
 
QPainter mP
 
bool mSelected
 
ScreenInfo msi
 
int overlayenlarge
 
int pointstyle
 
Qt::PenStyle style
 
int width
 

Detailed Description

KigPainter is an extended QPainter.

Currently the only difference is that it translates coordinates from and to the internal coordinates/ the widget coordinates...

It calls KigWidget::appendOverlay() for all of the places it draws in...

Definition at line 51 of file kigpainter.h.

Constructor & Destructor Documentation

KigPainter::KigPainter ( const ScreenInfo &  r,
QPaintDevice *  device,
const KigDocument &  doc,
bool  needOverlay = true 
)

construct a new KigPainter: the ScreenInfo is used to map the document coordinates to the widget coordinates.

This is done transparently to the objects. needOverlay sets whether we try to remember the places we're drawing on using the various overlay methods.

See also
overlay()

Definition at line 48 of file kigpainter.cpp.

KigPainter::~KigPainter ( )

Definition at line 66 of file kigpainter.cpp.

Member Function Documentation

const Rect KigPainter::boundingRect ( const Rect &  r,
const QString &  s,
int  f = 0 
) const

Definition at line 212 of file kigpainter.cpp.

const Rect KigPainter::boundingRect ( const Coordinate &  c,
const QString &  s,
int  f = 0 
) const

Definition at line 579 of file kigpainter.cpp.

void KigPainter::circleOverlay ( const Coordinate &  centre,
double  radius 
)
protected

adds a number of rects to mOverlay so that the rects entirely contain the circle...

See also
mOverlay

Definition at line 419 of file kigpainter.cpp.

void KigPainter::circleOverlayRecurse ( const Coordinate &  centre,
double  radius,
const Rect &  currentRect 
)
protected

Definition at line 354 of file kigpainter.cpp.

void KigPainter::drawAngle ( const Coordinate &  point,
double  startangle,
double  angle,
int  radius 
)

draw the angle with center point, with size angle, starting at the angle startAngle.

. Angles should be in radians.

Definition at line 631 of file kigpainter.cpp.

void KigPainter::drawArc ( const Coordinate &  center,
double  radius,
double  startangle,
double  angle 
)

draw the arc ( a part of a circle ), of the circle with center center, radius radius, with size angle, starting at the angle startAngle.

. Angles should be in radians..

Definition at line 957 of file kigpainter.cpp.

void KigPainter::drawArea ( const std::vector< Coordinate > &  pts,
bool  border = true 
)

draw an area defined by the points in pts filled with the set color...

Definition at line 327 of file kigpainter.cpp.

void KigPainter::drawCircle ( const Coordinate &  center,
double  radius 
)

draw a circle...

Definition at line 84 of file kigpainter.cpp.

void KigPainter::drawCurve ( const CurveImp *  curve)

draw a generic curve...

Definition at line 757 of file kigpainter.cpp.

void KigPainter::drawFatPoint ( const Coordinate &  p)

draw a thick point.

. This is what the user sees when he draws a point. In fact it isn't a point, but a filled circle of a certain radius...

Definition at line 101 of file kigpainter.cpp.

void KigPainter::drawFilledRect ( const QRect &  r)

draws a rect filled up with a pattern of cyan lines...

Definition at line 523 of file kigpainter.cpp.

void KigPainter::drawGrid ( const CoordinateSystem &  c,
bool  showGrid = true,
bool  showAxes = true 
)

Definition at line 507 of file kigpainter.cpp.

void KigPainter::drawLine ( const Coordinate &  p1,
const Coordinate &  p2 
)

draw a line...

Definition at line 187 of file kigpainter.cpp.

void KigPainter::drawLine ( const LineData &  d)

Definition at line 612 of file kigpainter.cpp.

void KigPainter::drawObject ( const ObjectHolder *  o,
bool  sel 
)

draw an object ( by calling its draw function.

. )

Definition at line 513 of file kigpainter.cpp.

void KigPainter::drawObjects ( const std::vector< ObjectHolder * > &  os,
bool  sel 
)

Definition at line 518 of file kigpainter.cpp.

template<typename iter >
void KigPainter::drawObjects ( iter  begin,
iter  end,
bool  sel 
)
inline

Definition at line 133 of file kigpainter.h.

void KigPainter::drawPoint ( const Coordinate &  p)

draw a point...

This means a single point, as in QPainter::drawPoint(), unlike drawFatPoint()...

Definition at line 181 of file kigpainter.cpp.

void KigPainter::drawPolygon ( const std::vector< QPoint > &  pts,
Qt::FillRule  fillRule = Qt::OddEvenFill 
)

draw a polygon defined by the points in pts...

Definition at line 303 of file kigpainter.cpp.

void KigPainter::drawPolygon ( const std::vector< Coordinate > &  pts,
Qt::FillRule  fillRule = Qt::OddEvenFill 
)

Definition at line 683 of file kigpainter.cpp.

void KigPainter::drawRay ( const Coordinate &  a,
const Coordinate &  b 
)

draw a ray...

Definition at line 594 of file kigpainter.cpp.

void KigPainter::drawRay ( const LineData &  d)

Definition at line 626 of file kigpainter.cpp.

void KigPainter::drawRect ( const Rect &  r)

draw a rect.

Definition at line 70 of file kigpainter.cpp.

void KigPainter::drawRect ( const QRect &  r)

overload, mainly for drawing the selection rectangle by KigWidget...

Definition at line 78 of file kigpainter.cpp.

void KigPainter::drawRightAngle ( const Coordinate &  point,
double  startangle,
int  diagonal 
)

draw the angle with center point, with size angle, starting at the angle startAngle.

. Angles should be in radians.

Definition at line 664 of file kigpainter.cpp.

void KigPainter::drawSegment ( const Coordinate &  from,
const Coordinate &  to 
)

draw a segment...

Definition at line 94 of file kigpainter.cpp.

void KigPainter::drawSegment ( const LineData &  d)

Definition at line 621 of file kigpainter.cpp.

void KigPainter::drawSimpleText ( const Coordinate &  c,
const QString &  s 
)

Definition at line 563 of file kigpainter.cpp.

void KigPainter::drawText ( const Rect &  r,
const QString &  s,
int  textFlags = 0 
)

draw text...

See also
QPainter::drawText()

Definition at line 192 of file kigpainter.cpp.

void KigPainter::drawText ( const Coordinate &  p,
const QString &  s,
int  textFlags = 0 
)

Definition at line 569 of file kigpainter.cpp.

void KigPainter::drawTextFrame ( const Rect &  frame,
const QString &  s,
bool  needframe 
)

Definition at line 933 of file kigpainter.cpp.

void KigPainter::drawTextStd ( const QPoint &  p,
const QString &  s 
)

draws text in a standard manner, convenience function...

Definition at line 531 of file kigpainter.cpp.

void KigPainter::drawVector ( const Coordinate &  a,
const Coordinate &  b 
)

draw a vector ( with an arrow etc.

)

Definition at line 692 of file kigpainter.cpp.

Coordinate KigPainter::fromScreen ( const QPoint &  p) const

Definition at line 584 of file kigpainter.cpp.

Rect KigPainter::fromScreen ( const QRect &  r) const

Definition at line 589 of file kigpainter.cpp.

QColor KigPainter::getColor ( ) const

Definition at line 281 of file kigpainter.cpp.

bool KigPainter::getNightVision ( ) const

Definition at line 276 of file kigpainter.cpp.

const std::vector<QRect>& KigPainter::overlay ( )
inline

Definition at line 257 of file kigpainter.h.

double KigPainter::overlayRectSize ( )
protected

the size we want the overlay rects to be...

Definition at line 472 of file kigpainter.cpp.

double KigPainter::pixelWidth ( )

Definition at line 489 of file kigpainter.cpp.

void KigPainter::pointOverlay ( const Coordinate &  p1)
protected

...

Definition at line 482 of file kigpainter.cpp.

void KigPainter::segmentOverlay ( const Coordinate &  p1,
const Coordinate &  p2 
)
protected

adds some rects to mOverlay, so that they cover the segment p1p2 completely...

See also
Object::getOverlay()

Definition at line 429 of file kigpainter.cpp.

void KigPainter::setBrush ( const QBrush &  b)

Definition at line 252 of file kigpainter.cpp.

void KigPainter::setBrushColor ( const QColor &  c)

Definition at line 265 of file kigpainter.cpp.

void KigPainter::setBrushStyle ( Qt::BrushStyle  c)

Definition at line 259 of file kigpainter.cpp.

void KigPainter::setColor ( const QColor &  c)

Definition at line 220 of file kigpainter.cpp.

void KigPainter::setFont ( const QFont &  f)

Definition at line 271 of file kigpainter.cpp.

void KigPainter::setPen ( const QPen &  p)

Definition at line 244 of file kigpainter.cpp.

void KigPainter::setPointStyle ( int  p)

Definition at line 239 of file kigpainter.cpp.

void KigPainter::setSelected ( bool  selected)

Definition at line 286 of file kigpainter.cpp.

void KigPainter::setStyle ( Qt::PenStyle  c)

Definition at line 226 of file kigpainter.cpp.

void KigPainter::setWholeWinOverlay ( )

this is called by some drawing functions that modify the 'entire' screen, i.e.

they do so many changes that it's easier to just update the entire screen, or else i have been to lazy to implement an appropriate overlay function ;) it clears mOverlay, and sets it to the entire widget...

Definition at line 494 of file kigpainter.cpp.

void KigPainter::setWidth ( int  c)

setting this to -1 means to use the default width for the object being drawn.

. a point -> 5, other objects -> 1

Definition at line 232 of file kigpainter.cpp.

const Rect KigPainter::simpleBoundingRect ( const Coordinate &  c,
const QString &  s 
)

Definition at line 573 of file kigpainter.cpp.

void KigPainter::textOverlay ( const QRect &  r,
const QString &  s,
int  textFlags 
)
protected

...

See also
drawText(), QPainter::boundingRect()

Definition at line 203 of file kigpainter.cpp.

QPoint KigPainter::toScreen ( const Coordinate &  p) const

Definition at line 502 of file kigpainter.cpp.

QRect KigPainter::toScreen ( const Rect &  r) const

Definition at line 545 of file kigpainter.cpp.

QRect KigPainter::toScreenEnlarge ( const Rect &  r) const

Definition at line 550 of file kigpainter.cpp.

void KigPainter::unsetSelected ( )
protected

Definition at line 477 of file kigpainter.cpp.

Rect KigPainter::window ( )

what rect are we drawing on ?

Definition at line 349 of file kigpainter.cpp.

Member Data Documentation

QColor KigPainter::brushColor
protected

Definition at line 64 of file kigpainter.h.

Qt::BrushStyle KigPainter::brushStyle
protected

Definition at line 63 of file kigpainter.h.

QColor KigPainter::color
protected

Definition at line 59 of file kigpainter.h.

const KigDocument& KigPainter::mdoc
protected

Definition at line 66 of file kigpainter.h.

bool KigPainter::mNeedOverlay
protected

Definition at line 69 of file kigpainter.h.

std::vector<QRect> KigPainter::mOverlay
protected

Definition at line 294 of file kigpainter.h.

QPainter KigPainter::mP
mutableprotected

Definition at line 57 of file kigpainter.h.

bool KigPainter::mSelected
protected

Definition at line 71 of file kigpainter.h.

ScreenInfo KigPainter::msi
protected

Definition at line 67 of file kigpainter.h.

int KigPainter::overlayenlarge
protected

Definition at line 70 of file kigpainter.h.

int KigPainter::pointstyle
protected

Definition at line 61 of file kigpainter.h.

Qt::PenStyle KigPainter::style
protected

Definition at line 60 of file kigpainter.h.

int KigPainter::width
protected

Definition at line 62 of file kigpainter.h.


The documentation for this class was generated from the following files:
  • kigpainter.h
  • kigpainter.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal