Line Class Reference

`#include <line.h>`

Inheritance diagram for Line:

## Public Member Functions

| Line (QWidget *parent=0)
| Constructor. More...
| Line (int fromX, int fromY, int toX, int toY, int w, QColor c, QWidget *parent=0)
| Constructor for a line, specifying the (fromX,fromY) and (toX,toY) More...
| Line (int fromX, int fromY, int length, double angle, int w, QColor c, QWidget *parent=0)
| Constructor for a line, specifying the (fromX,fromY) and (toX,toY) More...
void | setCoords (int fromX, int fromY, int toX, int toY)
| Setter for the line coordinates. More...
void | setpenColor (QColor c)
| Setter for the pen color. More...
void | setPenWidth (int w)
| Setter for the pen width. More...
int | getX0 ()
| Getter for the starting coordinate x. More...
int | getY0 ()
| Getter for the starting coordinate y. More...
int | getX1 ()
| Getter for the ending coordinate x. More...
int | getY1 ()
| Getter for the ending coordinate y. More...

## Protected Member Functions

void | paintEvent (QPaintEvent *)
| The paint event function is automatically invoked whenever a resize or repaint happens.

## Private Attributes

int | x0
int | y0
int | x1
int | y1
int | penWidth
QColor | penColor

## Detailed Description

A class to describe lines.

## Constructor & Destructor Documentation

Line::Line | ( | QWidget * | parent = `0` | ) |

explicit

Constructor.

Constructor sets coordinates to 0, pen color to black and pen width to 1.

Line::Line | ( | int | fromX,
|  | int | fromY,
|  | int | toX,
|  | int | toY,
|  | int | w,
|  | QColor | c,
|  | QWidget * | parent = `0`
| ) |  |

Constructor for a line, specifying the (fromX,fromY) and (toX,toY)

Parameters

  fromX | starting x coordinate
  fromY | starting y coordinate
  toX | end x coordinate
  toY | end y coordinate
  w | pen width
  c | line color
  parent | parent of this line

Line::Line | ( | int | fromX,
|  | int | fromY,
|  | int | length,
|  | double | angle,
|  | int | w,
|  | QColor | c,
|  | QWidget * | parent = `0`
| ) |  |

Constructor for a line, specifying the (fromX,fromY) and (toX,toY)

Constructor for a line, specifying (fromX, fromY) and the length and angle.

Parameters

  fromX | starting x coordinate
  fromY | starting y coordinate
  length | length of the line
  angle | angle
  w | pen width
  c | line color
  parent | parent of this line

## Member Function Documentation

int Line::getX0 | ( |  | ) |

Getter for the starting coordinate x.

Returns
  starting coordinate x.

int Line::getX1 | ( |  | ) |

Getter for the ending coordinate x.

Returns
  ending coordinate x.

int Line::getY0 | ( |  | ) |

Getter for the starting coordinate y.

Returns
  starting coordinate y.

int Line::getY1 | ( |  | ) |

Getter for the ending coordinate y.

Returns
  ending coordinate y.

void Line::setCoords | ( | int | fromX,
|  | int | fromY,
|  | int | toX,
|  | int | toY
| ) |  |

Setter for the line coordinates.

Parameters

  fromX | starting x coordinate
  fromY | starting y coordinate
  toX | end x coordinate
  toY | end y coordinate

void Line::setpenColor | ( | QColor | c | ) |

Setter for the pen color.

Parameters

  c | line color

void Line::setPenWidth | ( | int | w | ) |

Setter for the pen width.

Parameters

  w | pen width

## Member Data Documentation

QColor Line::penColor

private

pen color / color del boligrafo

int Line::penWidth

private

pen width / ancho del boligrafo

int Line::x0

private

initial coord x / coordenada inicial x

int Line::x1

private

ending coord x / coordenada final x

int Line::y0

private

initial coord y / coordenada inicial y

int Line::y1

private

ending coord y / coordenada final y

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

- line.h
- line.cpp