/usr/include/qgis/qgscomposerview.h is in libqgis-dev 1.7.4+1.7.5~20120320-1.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /***************************************************************************
qgscomposerview.h
-------------------
begin : January 2005
copyright : (C) 2005 by Radim Blazek
email : blazek@itc.it
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSCOMPOSERVIEW_H
#define QGSCOMPOSERVIEW_H
#include <QGraphicsView>
#include "qgsaddremoveitemcommand.h"
class QKeyEvent;
class QMainWindow;
class QMouseEvent;
class QgsComposition;
class QgsComposerArrow;
class QgsComposerItem;
class QgsComposerLabel;
class QgsComposerLegend;
class QgsComposerMap;
class QgsComposerPicture;
class QgsComposerScaleBar;
class QgsComposerShape;
class QgsComposerAttributeTable;
/** \ingroup MapComposer
* \ingroup gui
* 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.
*/
class GUI_EXPORT QgsComposerView: public QGraphicsView
{
Q_OBJECT
public:
/**Current tool*/
enum Tool
{
Select = 0, // Select/Move item
AddArrow, //add arrow
AddMap, // add new map
AddLegend, // add vector legend
AddLabel, // add label
AddScalebar, // add scalebar
AddPicture, // add raster/vector picture
AddShape, //add shape item (ellipse, rectangle, triangle)
AddTable, //add attribute table
MoveItemContent //move content of item (e.g. content of map)
};
QgsComposerView( QWidget* parent = 0, const char* name = 0, Qt::WFlags f = 0 );
/**Add an item group containing the selected items*/
void groupItems();
/**Ungroups the selected items*/
void ungroupItems();
QgsComposerView::Tool currentTool() const {return mCurrentTool;}
void setCurrentTool( QgsComposerView::Tool t ) {mCurrentTool = t;}
/**Sets composition (derived from QGraphicsScene)*/
void setComposition( QgsComposition* c );
/**Returns the composition or 0 in case of error*/
QgsComposition* composition();
/**Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerArrow( QgsComposerArrow* arrow );
/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLabel( QgsComposerLabel* label );
/**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerMap( QgsComposerMap* map );
/**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
/**Adds legend to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLegend( QgsComposerLegend* legend );
/**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerPicture( QgsComposerPicture* picture );
/**Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerShape( QgsComposerShape* shape );
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerTable( QgsComposerAttributeTable* table );
/**Returns the composer main window*/
QMainWindow* composerWindow();
void setPaintingEnabled( bool enabled ) { mPaintingEnabled = enabled; }
bool paintingEnabled() const { return mPaintingEnabled; }
/**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added );
protected:
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:
/**Status of shift key (used for multiple selection)*/
bool mShiftKeyPressed;
/**Current composer tool*/
QgsComposerView::Tool mCurrentTool;
/**Rubber band item*/
QGraphicsRectItem* mRubberBandItem;
/**Rubber band item for arrows*/
QGraphicsLineItem* mRubberBandLineItem;
/**Item to move content*/
QgsComposerItem* mMoveContentItem;
/**Start position of content move*/
QPointF mMoveContentStartPos;
/**Start of rubber band creation*/
QPointF mRubberBandStartPos;
bool mPaintingEnabled;
void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c );
public slots:
/**Casts object to the proper subclass type and calls corresponding itemAdded signal*/
void sendItemAddedSignal( QgsComposerItem* item );
signals:
/**Is emitted when selected item changed. If 0, no item is selected*/
void selectedItemChanged( QgsComposerItem* selected );
/**Is emitted when new composer arrow has been added to the view*/
void composerArrowAdded( QgsComposerArrow* arrow );
/**Is emitted when new composer label has been added to the view*/
void composerLabelAdded( QgsComposerLabel* label );
/**Is emitted when new composer map has been added to the view*/
void composerMapAdded( QgsComposerMap* map );
/**Is emitted when new composer scale bar has been added*/
void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
/**Is emitted when a new composer legend has been added*/
void composerLegendAdded( QgsComposerLegend* legend );
/**Is emitted when a new composer picture has been added*/
void composerPictureAdded( QgsComposerPicture* picture );
/**Is emitted when a new composer shape has been added*/
void composerShapeAdded( QgsComposerShape* shape );
/**Is emitted when a new composer table has been added*/
void composerTableAdded( QgsComposerAttributeTable* table );
/**Is emitted when a composer item has been removed from the scene*/
void itemRemoved( QgsComposerItem* );
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
QgsComposer may set the selection tool again*/
void actionFinished();
};
#endif
|