QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | 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>

Collaboration diagram for QgsComposerView:
Collaboration graph
[legend]

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)
QgsCompositioncomposition ()
 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.
QgsComposerItemmMoveContentItem
 Item to move content.
QPointF mMoveContentStartPos
 Start position of content move.
QPointF mRubberBandStartPos
 Start of rubber band creation.
bool mPaintingEnabled
QgsComposerRulermHorizontalRuler
QgsComposerRulermVerticalRuler

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

Member Enumeration Documentation

Current tool.

Enumerator:
Select 
AddArrow 
AddHtml 
AddMap 
AddLegend 
AddLabel 
AddScalebar 
AddPicture 
AddRectangle 
AddEllipse 
AddTriangle 
AddTable 
MoveItemContent 

Definition at line 54 of file qgscomposerview.h.

Constructor & Destructor Documentation

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

Definition at line 42 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 addShape(), mousePressEvent(), and mouseReleaseEvent().

void QgsComposerView::addShape ( Tool  currentTool)
private
void QgsComposerView::composerViewHide ( QgsComposerView )
signal

Emitted before composerview is hidden.

Referenced by hideEvent().

void QgsComposerView::composerViewShow ( QgsComposerView )
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().

QgsComposerView::Tool QgsComposerView::currentTool ( ) const
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().

void QgsComposerView::hideEvent ( QHideEvent *  e)
protected

Definition at line 634 of file qgscomposerview.cpp.

References composerViewHide().

void QgsComposerView::itemRemoved ( QgsComposerItem )
signal

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

Referenced by ungroupItems().

void QgsComposerView::keyPressEvent ( QKeyEvent *  e)
protected
void QgsComposerView::mouseDoubleClickEvent ( QMouseEvent *  e)
protected

Definition at line 470 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 621 of file qgscomposerview.cpp.

References mPaintingEnabled.

bool QgsComposerView::paintingEnabled ( ) const
inline

Definition at line 91 of file qgscomposerview.h.

void QgsComposerView::resizeEvent ( QResizeEvent *  event)
protected

Definition at line 646 of file qgscomposerview.cpp.

References updateRulers().

void QgsComposerView::scrollContentsBy ( int  dx,
int  dy 
)
protected

Definition at line 652 of file qgscomposerview.cpp.

References updateRulers().

void QgsComposerView::selectedItemChanged ( QgsComposerItem selected)
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().

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

Definition at line 80 of file qgscomposerview.h.

void QgsComposerView::setHorizontalRuler ( QgsComposerRuler r)
inline

Definition at line 96 of file qgscomposerview.h.

void QgsComposerView::setPaintingEnabled ( bool  enabled)
inline

Definition at line 90 of file qgscomposerview.h.

void QgsComposerView::setVerticalRuler ( QgsComposerRuler r)
inline

Definition at line 97 of file qgscomposerview.h.

void QgsComposerView::showEvent ( QShowEvent *  e)
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().

void QgsComposerView::wheelEvent ( QWheelEvent *  event)
protected

Member Data Documentation

QgsComposerView::Tool QgsComposerView::mCurrentTool
private

Current composer tool.

Definition at line 119 of file qgscomposerview.h.

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

QgsComposerRuler* QgsComposerView::mHorizontalRuler
private

Definition at line 133 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), setComposition(), and updateRulers().

QgsComposerItem* QgsComposerView::mMoveContentItem
private

Item to move content.

Definition at line 125 of file qgscomposerview.h.

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

QPointF QgsComposerView::mMoveContentStartPos
private

Start position of content move.

Definition at line 127 of file qgscomposerview.h.

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

bool QgsComposerView::mPaintingEnabled
private

Definition at line 131 of file qgscomposerview.h.

Referenced by paintEvent().

QGraphicsRectItem* QgsComposerView::mRubberBandItem
private

Rubber band item.

Definition at line 121 of file qgscomposerview.h.

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

QGraphicsLineItem* QgsComposerView::mRubberBandLineItem
private

Rubber band item for arrows.

Definition at line 123 of file qgscomposerview.h.

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

QPointF QgsComposerView::mRubberBandStartPos
private

Start of rubber band creation.

Definition at line 129 of file qgscomposerview.h.

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

QgsComposerRuler* QgsComposerView::mVerticalRuler
private

Definition at line 134 of file qgscomposerview.h.

Referenced by mouseMoveEvent(), setComposition(), and updateRulers().


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