QGIS API Documentation
2.0.1-Dufour
|
Widget to display the composer items. More...
#include <qgscomposerview.h>
Public Types | |
enum | Tool { Select = 0, AddArrow, AddHtml, AddMap, AddLegend, AddLabel, AddScalebar, AddPicture, AddRectangle, AddEllipse, AddTriangle, AddTable, MoveItemContent } |
Current tool. More... |
Signals | |
void | selectedItemChanged (QgsComposerItem *selected) |
Is emitted when selected item changed. | |
void | itemRemoved (QgsComposerItem *) |
Is emitted when a composer item has been removed from the scene. | |
void | actionFinished () |
Current action (e.g. | |
void | composerViewShow (QgsComposerView *) |
Emitted before composerview is shown. | |
void | composerViewHide (QgsComposerView *) |
Emitted before composerview is hidden. |
Public Member Functions | |
QgsComposerView (QWidget *parent=0, const char *name=0, Qt::WFlags f=0) | |
void | groupItems () |
Add an item group containing the selected items. | |
void | ungroupItems () |
Ungroups the selected items. | |
QgsComposerView::Tool | currentTool () const |
void | setCurrentTool (QgsComposerView::Tool t) |
void | setComposition (QgsComposition *c) |
Sets composition (derived from QGraphicsScene) | |
QgsComposition * | composition () |
Returns the composition or 0 in case of error. | |
QMainWindow * | composerWindow () |
Returns the composer main window. | |
void | setPaintingEnabled (bool enabled) |
bool | paintingEnabled () const |
void | updateRulers () |
Update rulers with current scene rect. | |
void | setHorizontalRuler (QgsComposerRuler *r) |
void | setVerticalRuler (QgsComposerRuler *r) |
Protected Member Functions | |
void | mousePressEvent (QMouseEvent *) |
void | mouseReleaseEvent (QMouseEvent *) |
void | mouseMoveEvent (QMouseEvent *) |
void | mouseDoubleClickEvent (QMouseEvent *e) |
void | keyPressEvent (QKeyEvent *e) |
void | wheelEvent (QWheelEvent *event) |
void | paintEvent (QPaintEvent *event) |
void | hideEvent (QHideEvent *e) |
void | showEvent (QShowEvent *e) |
void | resizeEvent (QResizeEvent *event) |
void | scrollContentsBy (int dx, int dy) |
Private Member Functions | |
void | addShape (Tool currentTool) |
Draw a shape on the canvas. |
Private Attributes | |
QgsComposerView::Tool | mCurrentTool |
Current composer tool. | |
QGraphicsRectItem * | mRubberBandItem |
Rubber band item. | |
QGraphicsLineItem * | mRubberBandLineItem |
Rubber band item for arrows. | |
QgsComposerItem * | mMoveContentItem |
Item to move content. | |
QPointF | mMoveContentStartPos |
Start position of content move. | |
QPointF | mRubberBandStartPos |
Start of rubber band creation. | |
bool | mPaintingEnabled |
QgsComposerRuler * | mHorizontalRuler |
QgsComposerRuler * | mVerticalRuler |
Widget to display the composer items.
Manages the composer tools and the mouse/key events. Creates the composer items according to the current map tools and keeps track of the rubber band item.
Definition at line 47 of file qgscomposerview.h.
Current tool.
Select | |
AddArrow | |
AddHtml | |
AddMap | |
AddLegend | |
AddLabel | |
AddScalebar | |
AddPicture | |
AddRectangle | |
AddEllipse | |
AddTriangle | |
AddTable | |
MoveItemContent |
Definition at line 54 of file qgscomposerview.h.
QgsComposerView::QgsComposerView | ( | QWidget * | parent = 0 , |
const char * | name = 0 , |
||
Qt::WFlags | f = 0 |
||
) |
Definition at line 42 of file qgscomposerview.cpp.
|
signal |
Current action (e.g.
adding composer map) has been finished. The purpose of this signal is that QgsComposer may set the selection tool again
Referenced by addShape(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Draw a shape on the canvas.
Definition at line 217 of file qgscomposerview.cpp.
References actionFinished(), QgsComposition::addComposerShape(), AddRectangle, AddTriangle, composition(), QgsComposerShape::Ellipse, mRubberBandItem, QgsComposition::pushAddRemoveCommand(), QgsComposerShape::Rectangle, QgsComposerShape::setShapeType(), tr, and QgsComposerShape::Triangle.
Referenced by mouseReleaseEvent().
|
signal |
Emitted before composerview is hidden.
Referenced by hideEvent().
|
signal |
Emitted before composerview is shown.
Referenced by showEvent().
QMainWindow * QgsComposerView::composerWindow | ( | ) |
Returns the composer main window.
Definition at line 731 of file qgscomposerview.cpp.
QgsComposition * QgsComposerView::composition | ( | ) |
Returns the composition or 0 in case of error.
Definition at line 671 of file qgscomposerview.cpp.
Referenced by addShape(), groupItems(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), ungroupItems(), and wheelEvent().
|
inline |
Definition at line 79 of file qgscomposerview.h.
void QgsComposerView::groupItems | ( | ) |
Add an item group containing the selected items.
Definition at line 684 of file qgscomposerview.cpp.
References QgsComposerItemGroup::addItem(), composition(), QgsComposition::selectedComposerItems(), selectedItemChanged(), and QgsComposerItem::setSelected().
|
protected |
Definition at line 634 of file qgscomposerview.cpp.
References composerViewHide().
|
signal |
Is emitted when a composer item has been removed from the scene.
Referenced by ungroupItems().
|
protected |
Definition at line 475 of file qgscomposerview.cpp.
References QgsComposition::addItemsFromXML(), composition(), QgsComposerMergeCommand::ItemMove, QgsComposerItemGroup::items(), QgsComposition::removeComposerItem(), QgsComposition::selectedComposerItems(), and tr.
|
protected |
Definition at line 470 of file qgscomposerview.cpp.
|
protected |
Definition at line 363 of file qgscomposerview.cpp.
References AddArrow, AddEllipse, AddHtml, AddMap, AddRectangle, AddTriangle, composition(), mCurrentTool, mHorizontalRuler, mMoveContentItem, mMoveContentStartPos, MoveItemContent, mRubberBandItem, mRubberBandLineItem, mRubberBandStartPos, mVerticalRuler, Select, QgsComposerMap::setOffset(), QgsComposerRuler::updateMarker(), and updateRulers().
|
protected |
Definition at line 60 of file qgscomposerview.cpp.
References actionFinished(), AddArrow, QgsComposition::addComposerLabel(), QgsComposition::addComposerLegend(), QgsComposition::addComposerPicture(), QgsComposition::addComposerScaleBar(), QgsComposition::addComposerTable(), AddEllipse, AddHtml, AddLabel, AddLegend, AddMap, AddPicture, AddRectangle, AddScalebar, AddTable, AddTriangle, QgsComposerLabel::adjustSizeToText(), QgsComposerScaleBar::applyDefaultSize(), QgsComposition::composerItemAt(), QgsComposition::composerMapItems(), composition(), mCurrentTool, mMoveContentItem, mMoveContentStartPos, MoveItemContent, mRubberBandItem, mRubberBandLineItem, mRubberBandStartPos, QgsComposerItem::positionLock(), QgsComposition::pushAddRemoveCommand(), Select, selectedItemChanged(), QgsComposerScaleBar::setComposerMap(), QgsComposerItem::setPositionLock(), QgsComposerPicture::setSceneRect(), QgsComposerAttributeTable::setSceneRect(), QgsComposerLabel::setSceneRect(), QgsComposerItem::setSceneRect(), QgsComposerItem::setSelected(), QgsComposerLabel::setText(), QgsComposition::snapPointToGrid(), tr, QgsComposerItem::updateCursor(), and QgsComposerLegend::updateLegend().
|
protected |
Definition at line 258 of file qgscomposerview.cpp.
References actionFinished(), AddArrow, QgsComposition::addComposerArrow(), QgsComposition::addComposerMap(), QgsAddRemoveMultiFrameCommand::Added, AddEllipse, QgsComposerHtml::addFrame(), AddHtml, AddMap, AddRectangle, addShape(), AddTriangle, QgsComposition::beginCommand(), QgsComposition::beginMultiFrameCommand(), composition(), QgsComposition::endCommand(), QgsComposition::endMultiFrameCommand(), mCurrentTool, mMoveContentItem, mMoveContentStartPos, QgsComposerItem::moveContent(), MoveItemContent, mRubberBandItem, mRubberBandLineItem, mRubberBandStartPos, QgsComposition::pushAddRemoveCommand(), Select, QgsComposerMap::setOffset(), QgsComposition::snapPointToGrid(), tr, and QgsComposition::undoStack().
|
protected |
Definition at line 621 of file qgscomposerview.cpp.
References mPaintingEnabled.
|
inline |
Definition at line 91 of file qgscomposerview.h.
|
protected |
Definition at line 646 of file qgscomposerview.cpp.
References updateRulers().
|
protected |
Definition at line 652 of file qgscomposerview.cpp.
References updateRulers().
|
signal |
Is emitted when selected item changed.
If 0, no item is selected
Referenced by groupItems(), and mousePressEvent().
void QgsComposerView::setComposition | ( | QgsComposition * | c | ) |
Sets composition (derived from QGraphicsScene)
Definition at line 658 of file qgscomposerview.cpp.
References mHorizontalRuler, mVerticalRuler, and QgsComposerRuler::setComposition().
|
inline |
Definition at line 80 of file qgscomposerview.h.
|
inline |
Definition at line 96 of file qgscomposerview.h.
|
inline |
Definition at line 90 of file qgscomposerview.h.
|
inline |
Definition at line 97 of file qgscomposerview.h.
|
protected |
Definition at line 640 of file qgscomposerview.cpp.
References composerViewShow().
void QgsComposerView::ungroupItems | ( | ) |
Ungroups the selected items.
Definition at line 709 of file qgscomposerview.cpp.
References composition(), itemRemoved(), QgsComposerItemGroup::removeItems(), and QgsComposition::selectedComposerItems().
void QgsComposerView::updateRulers | ( | ) |
Update rulers with current scene rect.
Definition at line 246 of file qgscomposerview.cpp.
References mHorizontalRuler, mVerticalRuler, and QgsComposerRuler::setSceneTransform().
Referenced by mouseMoveEvent(), resizeEvent(), and scrollContentsBy().
|
protected |
Definition at line 603 of file qgscomposerview.cpp.
References QgsComposerItem::beginCommand(), QgsComposition::composerItemAt(), composition(), and tr.
|
private |
Current composer tool.
Definition at line 119 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Definition at line 133 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), setComposition(), and updateRulers().
|
private |
Item to move content.
Definition at line 125 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Start position of content move.
Definition at line 127 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Definition at line 131 of file qgscomposerview.h.
Referenced by paintEvent().
|
private |
Rubber band item.
Definition at line 121 of file qgscomposerview.h.
Referenced by addShape(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Rubber band item for arrows.
Definition at line 123 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Start of rubber band creation.
Definition at line 129 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Definition at line 134 of file qgscomposerview.h.
Referenced by mouseMoveEvent(), setComposition(), and updateRulers().