Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QgsComposerView Class Reference

Widget to display the composer items. More...

#include <qgscomposerview.h>

Inheritance diagram for QgsComposerView:
Inheritance graph
[legend]
Collaboration diagram for QgsComposerView:
Collaboration graph
[legend]

Public Types

enum  Tool {
  Select = 0, AddArrow, AddMap, AddLegend,
  AddLabel, AddScalebar, AddPicture, AddShape,
  AddTable, MoveItemContent
}
 Current tool. More...
 

Public Slots

void sendItemAddedSignal (QgsComposerItem *item)
 Casts object to the proper subclass type and calls corresponding itemAdded signal. More...
 

Signals

void selectedItemChanged (QgsComposerItem *selected)
 Is emitted when selected item changed. More...
 
void composerArrowAdded (QgsComposerArrow *arrow)
 Is emitted when new composer arrow has been added to the view. More...
 
void composerLabelAdded (QgsComposerLabel *label)
 Is emitted when new composer label has been added to the view. More...
 
void composerMapAdded (QgsComposerMap *map)
 Is emitted when new composer map has been added to the view. More...
 
void composerScaleBarAdded (QgsComposerScaleBar *scalebar)
 Is emitted when new composer scale bar has been added. More...
 
void composerLegendAdded (QgsComposerLegend *legend)
 Is emitted when a new composer legend has been added. More...
 
void composerPictureAdded (QgsComposerPicture *picture)
 Is emitted when a new composer picture has been added. More...
 
void composerShapeAdded (QgsComposerShape *shape)
 Is emitted when a new composer shape has been added. More...
 
void composerTableAdded (QgsComposerAttributeTable *table)
 Is emitted when a new composer table has been added. More...
 
void itemRemoved (QgsComposerItem *)
 Is emitted when a composer item has been removed from the scene. More...
 
void actionFinished ()
 Current action (e.g. More...
 

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. More...
 
void ungroupItems ()
 Ungroups the selected items. More...
 
QgsComposerView::Tool currentTool () const
 
void setCurrentTool (QgsComposerView::Tool t)
 
void setComposition (QgsComposition *c)
 Sets composition (derived from QGraphicsScene) More...
 
QgsCompositioncomposition ()
 Returns the composition or 0 in case of error. More...
 
void addComposerArrow (QgsComposerArrow *arrow)
 Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerLabel (QgsComposerLabel *label)
 Adds label to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerMap (QgsComposerMap *map)
 Adds map to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerScaleBar (QgsComposerScaleBar *scaleBar)
 Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerLegend (QgsComposerLegend *legend)
 Adds legend to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerPicture (QgsComposerPicture *picture)
 Adds picture to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerShape (QgsComposerShape *shape)
 Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerTable (QgsComposerAttributeTable *table)
 Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal) More...
 
QMainWindow * composerWindow ()
 Returns the composer main window. More...
 
void setPaintingEnabled (bool enabled)
 
bool paintingEnabled () const
 
void pushAddRemoveCommand (QgsComposerItem *item, const QString &text, QgsAddRemoveItemCommand::State state=QgsAddRemoveItemCommand::Added)
 Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack. More...
 

Protected Member Functions

void mousePressEvent (QMouseEvent *)
 
void mouseReleaseEvent (QMouseEvent *)
 
void mouseMoveEvent (QMouseEvent *)
 
void mouseDoubleClickEvent (QMouseEvent *e)
 
void keyPressEvent (QKeyEvent *e)
 
void keyReleaseEvent (QKeyEvent *e)
 
void wheelEvent (QWheelEvent *event)
 
void paintEvent (QPaintEvent *event)
 

Private Member Functions

void connectAddRemoveCommandSignals (QgsAddRemoveItemCommand *c)
 

Private Attributes

bool mShiftKeyPressed
 Status of shift key (used for multiple selection) More...
 
QgsComposerView::Tool mCurrentTool
 Current composer tool. More...
 
QGraphicsRectItem * mRubberBandItem
 Rubber band item. More...
 
QGraphicsLineItem * mRubberBandLineItem
 Rubber band item for arrows. More...
 
QgsComposerItemmMoveContentItem
 Item to move content. More...
 
QPointF mMoveContentStartPos
 Start position of content move. More...
 
QPointF mRubberBandStartPos
 Start of rubber band creation. More...
 
bool mPaintingEnabled
 

Detailed Description

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 45 of file qgscomposerview.h.

Member Enumeration Documentation

Current tool.

Enumerator
Select 
AddArrow 
AddMap 
AddLegend 
AddLabel 
AddScalebar 
AddPicture 
AddShape 
AddTable 
MoveItemContent 

Definition at line 52 of file qgscomposerview.h.

Constructor & Destructor Documentation

QgsComposerView::QgsComposerView ( QWidget *  parent = 0,
const char *  name = 0,
Qt::WFlags  f = 0 
)

Definition at line 33 of file qgscomposerview.cpp.

Member Function Documentation

void QgsComposerView::actionFinished ( )
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 mousePressEvent(), and mouseReleaseEvent().

void QgsComposerView::addComposerArrow ( QgsComposerArrow arrow)

Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 512 of file qgscomposerview.cpp.

References composerArrowAdded(), composition(), pushAddRemoveCommand(), selectedItemChanged(), and QgsComposerItem::setSelected().

Referenced by mouseReleaseEvent().

void QgsComposerView::addComposerLabel ( QgsComposerLabel label)

Adds label to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 522 of file qgscomposerview.cpp.

References composerLabelAdded(), composition(), pushAddRemoveCommand(), selectedItemChanged(), and QgsComposerItem::setSelected().

Referenced by mousePressEvent().

void QgsComposerView::addComposerLegend ( QgsComposerLegend legend)

Adds legend to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 562 of file qgscomposerview.cpp.

References composerLegendAdded(), QgsComposition::composerMapItems(), composition(), pushAddRemoveCommand(), selectedItemChanged(), QgsComposerLegend::setComposerMap(), and QgsComposerItem::setSelected().

Referenced by mousePressEvent().

void QgsComposerView::addComposerMap ( QgsComposerMap map)

Adds map to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 532 of file qgscomposerview.cpp.

References QgsComposerMap::Cache, QgsComposerMap::cache(), composerMapAdded(), pushAddRemoveCommand(), selectedItemChanged(), QgsComposerMap::setPreviewMode(), and QgsComposerItem::setSelected().

Referenced by mouseReleaseEvent().

void QgsComposerView::addComposerPicture ( QgsComposerPicture picture)

Adds picture to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 578 of file qgscomposerview.cpp.

References composerPictureAdded(), pushAddRemoveCommand(), selectedItemChanged(), and QgsComposerItem::setSelected().

Referenced by mousePressEvent().

void QgsComposerView::addComposerScaleBar ( QgsComposerScaleBar scaleBar)

Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 545 of file qgscomposerview.cpp.

References QgsComposerScaleBar::applyDefaultSize(), QgsComposition::composerMapItems(), composerScaleBarAdded(), composition(), pushAddRemoveCommand(), selectedItemChanged(), QgsComposerScaleBar::setComposerMap(), and QgsComposerItem::setSelected().

Referenced by mousePressEvent().

void QgsComposerView::addComposerShape ( QgsComposerShape shape)

Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 588 of file qgscomposerview.cpp.

References composerShapeAdded(), pushAddRemoveCommand(), selectedItemChanged(), and QgsComposerItem::setSelected().

Referenced by mouseReleaseEvent().

void QgsComposerView::addComposerTable ( QgsComposerAttributeTable table)

Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 598 of file qgscomposerview.cpp.

References composerTableAdded(), pushAddRemoveCommand(), selectedItemChanged(), and QgsComposerItem::setSelected().

Referenced by mousePressEvent().

void QgsComposerView::composerArrowAdded ( QgsComposerArrow arrow)
signal

Is emitted when new composer arrow has been added to the view.

Referenced by addComposerArrow(), and sendItemAddedSignal().

void QgsComposerView::composerLabelAdded ( QgsComposerLabel label)
signal

Is emitted when new composer label has been added to the view.

Referenced by addComposerLabel(), and sendItemAddedSignal().

void QgsComposerView::composerLegendAdded ( QgsComposerLegend legend)
signal

Is emitted when a new composer legend has been added.

Referenced by addComposerLegend(), and sendItemAddedSignal().

void QgsComposerView::composerMapAdded ( QgsComposerMap map)
signal

Is emitted when new composer map has been added to the view.

Referenced by addComposerMap(), and sendItemAddedSignal().

void QgsComposerView::composerPictureAdded ( QgsComposerPicture picture)
signal

Is emitted when a new composer picture has been added.

Referenced by addComposerPicture(), and sendItemAddedSignal().

void QgsComposerView::composerScaleBarAdded ( QgsComposerScaleBar scalebar)
signal

Is emitted when new composer scale bar has been added.

Referenced by addComposerScaleBar(), and sendItemAddedSignal().

void QgsComposerView::composerShapeAdded ( QgsComposerShape shape)
signal

Is emitted when a new composer shape has been added.

Referenced by addComposerShape(), and sendItemAddedSignal().

void QgsComposerView::composerTableAdded ( QgsComposerAttributeTable table)
signal

Is emitted when a new composer table has been added.

Referenced by addComposerTable(), and sendItemAddedSignal().

QMainWindow * QgsComposerView::composerWindow ( )

Returns the composer main window.

Definition at line 717 of file qgscomposerview.cpp.

QgsComposition * QgsComposerView::composition ( )
void QgsComposerView::connectAddRemoveCommandSignals ( QgsAddRemoveItemCommand c)
private

Definition at line 739 of file qgscomposerview.cpp.

References itemRemoved(), and sendItemAddedSignal().

Referenced by keyPressEvent(), and pushAddRemoveCommand().

QgsComposerView::Tool QgsComposerView::currentTool ( ) const
inline

Definition at line 74 of file qgscomposerview.h.

void QgsComposerView::groupItems ( )

Add an item group containing the selected items.

Definition at line 608 of file qgscomposerview.cpp.

References QgsComposerItemGroup::addItem(), composition(), QgsComposition::selectedComposerItems(), selectedItemChanged(), and QgsComposerItem::setSelected().

void QgsComposerView::itemRemoved ( QgsComposerItem )
signal

Is emitted when a composer item has been removed from the scene.

Referenced by connectAddRemoveCommandSignals(), keyPressEvent(), and ungroupItems().

void QgsComposerView::keyPressEvent ( QKeyEvent *  e)
protected
void QgsComposerView::keyReleaseEvent ( QKeyEvent *  e)
protected

Definition at line 455 of file qgscomposerview.cpp.

References mShiftKeyPressed.

void QgsComposerView::mouseDoubleClickEvent ( QMouseEvent *  e)
protected

Definition at line 368 of file qgscomposerview.cpp.

void QgsComposerView::mouseMoveEvent ( QMouseEvent *  e)
protected
void QgsComposerView::mousePressEvent ( QMouseEvent *  e)
protected
void QgsComposerView::mouseReleaseEvent ( QMouseEvent *  e)
protected
void QgsComposerView::paintEvent ( QPaintEvent *  event)
protected

Definition at line 481 of file qgscomposerview.cpp.

References mPaintingEnabled.

bool QgsComposerView::paintingEnabled ( ) const
inline

Definition at line 103 of file qgscomposerview.h.

void QgsComposerView::pushAddRemoveCommand ( QgsComposerItem item,
const QString &  text,
QgsAddRemoveItemCommand::State  state = QgsAddRemoveItemCommand::Added 
)
void QgsComposerView::selectedItemChanged ( QgsComposerItem selected)
signal
void QgsComposerView::sendItemAddedSignal ( QgsComposerItem item)
slot
void QgsComposerView::setComposition ( QgsComposition c)

Sets composition (derived from QGraphicsScene)

Definition at line 494 of file qgscomposerview.cpp.

void QgsComposerView::setCurrentTool ( QgsComposerView::Tool  t)
inline

Definition at line 75 of file qgscomposerview.h.

void QgsComposerView::setPaintingEnabled ( bool  enabled)
inline

Definition at line 102 of file qgscomposerview.h.

void QgsComposerView::ungroupItems ( )

Ungroups the selected items.

Definition at line 633 of file qgscomposerview.cpp.

References composition(), itemRemoved(), QgsComposerItemGroup::removeItems(), and QgsComposition::selectedComposerItems().

void QgsComposerView::wheelEvent ( QWheelEvent *  event)
protected

Member Data Documentation

QgsComposerView::Tool QgsComposerView::mCurrentTool
private

Current composer tool.

Definition at line 126 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QgsComposerItem* QgsComposerView::mMoveContentItem
private

Item to move content.

Definition at line 132 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QPointF QgsComposerView::mMoveContentStartPos
private

Start position of content move.

Definition at line 134 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

bool QgsComposerView::mPaintingEnabled
private

Definition at line 138 of file qgscomposerview.h.

Referenced by paintEvent().

QGraphicsRectItem* QgsComposerView::mRubberBandItem
private

Rubber band item.

Definition at line 128 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QGraphicsLineItem* QgsComposerView::mRubberBandLineItem
private

Rubber band item for arrows.

Definition at line 130 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QPointF QgsComposerView::mRubberBandStartPos
private

Start of rubber band creation.

Definition at line 136 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

bool QgsComposerView::mShiftKeyPressed
private

Status of shift key (used for multiple selection)

Definition at line 124 of file qgscomposerview.h.

Referenced by keyPressEvent(), keyReleaseEvent(), and mousePressEvent().


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