#include <map.h>
Public Slots | |
void | zoomIn () |
void | zoomOut () |
void | fitView () |
void | scaleDefault () |
Signals | |
void | mapSetVisible (bool) |
Emitted if the map change its visibility. | |
void | mapClosed () |
Emitted if the map is closed. | |
Public Member Functions | |
Map (QWidget *parent=0) | |
Create a Map derived from QGraphicsView. | |
Map (QGraphicsScene *scene, QWidget *parent=0) | |
void | setName (const QString &name) |
Set the map name as defined by the user. | |
QString | name () |
void | addItem (QGraphicsItem *item) |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) |
void | wheelEvent (QWheelEvent *event) |
void | scaleView (qreal scaleFactor) |
void | scaleView (qreal scaleFactor, const QPoint &pos) |
Private Attributes | |
QString | _name |
The user friendly name. | |
QGraphicsScene * | _scene |
The QGraphicsScene for drawing the rails. |
Implement a map to represent a railroad model with a QGraphicsScene. It allow the user to interact with the shuntings and the signals
Definition at line 27 of file map.h.
Map::Map | ( | QWidget * | parent = 0 |
) |
void Map::setName | ( | const QString & | name | ) |
Set the map name as defined by the user.
name | A name, could be whatever the user want, and should not bu unique |
Definition at line 17 of file map.cpp.
References _name.
Referenced by Win::addMap(), and Win::open().
QString Map::name | ( | ) |
Definition at line 22 of file map.cpp.
References _name.
Referenced by Win::addMap(), and Win::save().
void Map::addItem | ( | QGraphicsItem * | item | ) |
item | Item to add on the map |
Definition at line 28 of file map.cpp.
Referenced by Win::open().
void Map::mapSetVisible | ( | bool | ) | [signal] |
void Map::mapClosed | ( | ) | [signal] |
void Map::zoomIn | ( | ) | [slot] |
Zoom in on the map
Definition at line 33 of file map.cpp.
References scaleView().
void Map::zoomOut | ( | ) | [slot] |
Zoom out on the map
Definition at line 38 of file map.cpp.
References scaleView().
void Map::fitView | ( | ) | [slot] |
Fit the view to the avalaible space
void Map::scaleDefault | ( | ) | [slot] |
void Map::closeEvent | ( | QCloseEvent * | event | ) | [protected] |
Reimplemented, handle close event
Definition at line 73 of file map.cpp.
References mapClosed(), and mapSetVisible().
void Map::wheelEvent | ( | QWheelEvent * | event | ) | [protected] |
void Map::scaleView | ( | qreal | scaleFactor | ) | [protected] |
Set the zoom factor to scaleFactor
scaleFactor | The zoom factor |
Definition at line 58 of file map.cpp.
Referenced by scaleView(), wheelEvent(), zoomIn(), and zoomOut().
void Map::scaleView | ( | qreal | scaleFactor, | |
const QPoint & | pos | |||
) | [protected] |
QString Map::_name [private] |
QGraphicsScene* Map::_scene [private] |