1
/***************************************************************************
5
copyright : (C) 2005 by Radim Blazek
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#ifndef QGSCOMPOSERVIEW_H
19
#define QGSCOMPOSERVIEW_H
21
#include <QGraphicsView>
27
class QgsComposerArrow;
28
class QgsComposerItem;
29
class QgsComposerLabel;
30
class QgsComposerLegend;
32
class QgsComposerPicture;
33
class QgsComposerScaleBar;
34
class QgsComposerShape;
36
/** \ingroup MapComposer
38
* Widget to display the composer items. Manages the composer tools and the
40
* Creates the composer items according to the current map tools and keeps track
41
* of the rubber band item.
43
class GUI_EXPORT QgsComposerView: public QGraphicsView
52
Select = 0, // Select/Move item
54
AddMap, // add new map
55
AddLegend, // add vector legend
56
AddLabel, // add label
57
AddScalebar, // add scalebar
58
AddPicture, // add raster/vector picture
59
AddShape, //add shape item (ellipse, rectangle, triangle)
60
MoveItemContent //move content of item (e.g. content of map)
63
QgsComposerView( QWidget* parent = 0, const char* name = 0, Qt::WFlags f = 0 );
65
/**Add an item group containing the selected items*/
68
/**Ungroups the selected items*/
71
QgsComposerView::Tool currentTool() const {return mCurrentTool;}
72
void setCurrentTool( QgsComposerView::Tool t ) {mCurrentTool = t;}
74
/**Sets composition (derived from QGraphicsScene)*/
75
void setComposition( QgsComposition* c );
76
/**Returns the composition or 0 in case of error*/
77
QgsComposition* composition();
79
/**Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)*/
80
void addComposerArrow( QgsComposerArrow* arrow );
81
/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
82
void addComposerLabel( QgsComposerLabel* label );
83
/**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
84
void addComposerMap( QgsComposerMap* map );
85
/**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/
86
void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
87
/**Adds legend to the graphics scene and advices composer to create a widget for it (through signal)*/
88
void addComposerLegend( QgsComposerLegend* legend );
89
/**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/
90
void addComposerPicture( QgsComposerPicture* picture );
91
/**Adds a composer shape to the graphics scene and acvices composer to create a widget for it (through signal)*/
92
void addComposerShape( QgsComposerShape* shape );
94
/**Returns the composer main window*/
95
QMainWindow* composerWindow();
98
void mousePressEvent( QMouseEvent* );
99
void mouseReleaseEvent( QMouseEvent* );
100
void mouseMoveEvent( QMouseEvent* );
102
void keyPressEvent( QKeyEvent * e );
103
void keyReleaseEvent( QKeyEvent * e );
105
void wheelEvent( QWheelEvent* event );
108
/**Status of shift key (used for multiple selection)*/
109
bool mShiftKeyPressed;
110
/**Current composer tool*/
111
QgsComposerView::Tool mCurrentTool;
112
/**Rubber band item*/
113
QGraphicsRectItem* mRubberBandItem;
114
/**Rubber band item for arrows*/
115
QGraphicsLineItem* mRubberBandLineItem;
116
/**Item to move content*/
117
QgsComposerItem* mMoveContentItem;
118
/**Start position of content move*/
119
QPointF mMoveContentStartPos;
120
/**Start of rubber band creation*/
121
QPointF mRubberBandStartPos;
124
/**For QgsComposerItemGroup to send its signals to QgsComposer (or other classes that keep track of input widgets)*/
125
void sendItemRemovedSignal( QgsComposerItem* item );
128
/**Is emitted when selected item changed. If 0, no item is selected*/
129
void selectedItemChanged( const QgsComposerItem* selected );
130
/**Is emitted when new composer arrow has been added to the view*/
131
void composerArrowAdded( QgsComposerArrow* arrow );
132
/**Is emitted when new composer label has been added to the view*/
133
void composerLabelAdded( QgsComposerLabel* label );
134
/**Is emitted when new composer map has been added to the view*/
135
void composerMapAdded( QgsComposerMap* map );
136
/**Is emitted when new composer scale bar has been added*/
137
void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
138
/**Is emitted when a new composer legend has been added*/
139
void composerLegendAdded( QgsComposerLegend* legend );
140
/**Is emitted when a new composer picture has been added*/
141
void composerPictureAdded( QgsComposerPicture* picture );
142
/**Is emitted when a new composer shape has been added*/
143
void composerShapeAdded( QgsComposerShape* shape );
144
/**Is emitted when a composer item has been removed from the scene*/
145
void itemRemoved( QgsComposerItem* );
146
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
147
QgsComposer may set the selection tool again*/
148
void actionFinished();