QGIS API Documentation  2.99.0-Master (0cba29c)
Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsComposerView Class Reference

Widget to display the composer items. More...

#include <qgscomposerview.h>

Inheritance diagram for QgsComposerView:
Inheritance graph
[legend]

Public Types

enum  ClipboardMode { ClipboardModeCut, ClipboardModeCopy }
 
enum  PasteMode { PasteModeCursor, PasteModeCenter, PasteModeInPlace }
 
enum  Tool {
  Select = 0, AddArrow, AddHtml, AddMap,
  AddLegend, AddLabel, AddScalebar, AddPicture,
  AddRectangle, AddEllipse, AddPolygon, AddPolyline,
  AddTriangle, AddTable, AddAttributeTable, MoveItemContent,
  EditNodesItem, Pan, Zoom
}
 Current tool. More...
 
enum  ToolStatus { Inactive, Active, ActiveUntilMouseRelease }
 

Signals

void actionFinished ()
 Current action (e.g. More...
 
void composerViewHide (QgsComposerView *)
 Emitted before composerview is hidden. More...
 
void composerViewShow (QgsComposerView *)
 Emitted before composerview is shown. More...
 
void compositionSet (QgsComposition *)
 Emitted when the composition is set for the view. More...
 
void cursorPosChanged (QPointF)
 Is emitted when mouse cursor coordinates change. More...
 
void itemRemoved (QgsComposerItem *)
 Is emitted when a composer item has been removed from the scene. More...
 
void selectedItemChanged (QgsComposerItem *selected)
 Is emitted when selected item changed. If 0, no item is selected. More...
 
void zoomLevelChanged ()
 Is emitted when the view zoom changes. More...
 

Public Member Functions

 QgsComposerView (QWidget *parent=nullptr, const char *name=nullptr, Qt::WindowFlags f=0)
 
QMainWindow * composerWindow ()
 Returns the composer main window. More...
 
QgsCompositioncomposition ()
 Returns the composition or 0 in case of error. More...
 
void copyItems (ClipboardMode mode)
 Cuts or copies the selected items. More...
 
QgsComposerView::Tool currentTool () const
 
void deleteSelectedItems ()
 Deletes selected items. More...
 
void groupItems ()
 Add an item group containing the selected items. More...
 
QgsMapCanvasmapCanvas () const
 Returns the map canvas associated with the view. More...
 
bool paintingEnabled () const
 
void pasteItems (PasteMode mode)
 Pastes items from clipboard. More...
 
void scaleSafe (double scale)
 Scales the view in a safe way, by limiting the acceptable range of the scale applied. More...
 
void selectAll ()
 Selects all items. More...
 
void selectInvert ()
 Inverts current selection. More...
 
void selectNone ()
 Deselects all items. More...
 
void setComposition (QgsComposition *c)
 Sets the composition for the view. More...
 
void setCurrentTool (QgsComposerView::Tool t)
 
void setHorizontalRuler (QgsComposerRuler *r)
 
void setMapCanvas (QgsMapCanvas *canvas)
 Sets the map canvas associated with the view. More...
 
void setPaintingEnabled (bool enabled)
 
void setPreviewMode (QgsPreviewEffect::PreviewMode mode)
 Sets the preview mode which should be used to modify the view's appearance. More...
 
void setPreviewModeEnabled (bool enabled)
 Sets whether a preview effect should be used to alter the view's appearance. More...
 
void setVerticalRuler (QgsComposerRuler *r)
 
void setZoomLevel (double zoomLevel)
 Set zoom level, where a zoom level of 1.0 corresponds to 100%. More...
 
void ungroupItems ()
 Ungroups the selected items. More...
 
void updateRulers ()
 Update rulers with current scene rect. More...
 

Protected Member Functions

void hideEvent (QHideEvent *e) override
 
void keyPressEvent (QKeyEvent *e) override
 
void keyReleaseEvent (QKeyEvent *e) override
 
void mouseDoubleClickEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *) override
 
void mousePressEvent (QMouseEvent *) override
 
void mouseReleaseEvent (QMouseEvent *) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void scrollContentsBy (int dx, int dy) override
 
void showEvent (QShowEvent *e) override
 
void wheelEvent (QWheelEvent *event) override
 

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

Member Enumeration Documentation

◆ ClipboardMode

Enumerator
ClipboardModeCut 
ClipboardModeCopy 

Definition at line 91 of file qgscomposerview.h.

◆ PasteMode

Enumerator
PasteModeCursor 
PasteModeCenter 
PasteModeInPlace 

Definition at line 97 of file qgscomposerview.h.

◆ Tool

Current tool.

Enumerator
Select 
AddArrow 
AddHtml 
AddMap 
AddLegend 
AddLabel 
AddScalebar 
AddPicture 
AddRectangle 
AddEllipse 
AddPolygon 
AddPolyline 
AddTriangle 
AddTable 
AddAttributeTable 
MoveItemContent 
EditNodesItem 
Pan 
Zoom 

Definition at line 68 of file qgscomposerview.h.

◆ ToolStatus

Enumerator
Inactive 
Active 
ActiveUntilMouseRelease 

Definition at line 104 of file qgscomposerview.h.

Constructor & Destructor Documentation

◆ QgsComposerView()

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

Definition at line 55 of file qgscomposerview.cpp.

Member Function Documentation

◆ actionFinished

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

◆ composerViewHide

void QgsComposerView::composerViewHide ( QgsComposerView )
signal

Emitted before composerview is hidden.

◆ composerViewShow

void QgsComposerView::composerViewShow ( QgsComposerView )
signal

Emitted before composerview is shown.

◆ composerWindow()

QMainWindow * QgsComposerView::composerWindow ( )

Returns the composer main window.

Definition at line 2221 of file qgscomposerview.cpp.

◆ composition()

QgsComposition * QgsComposerView::composition ( )

Returns the composition or 0 in case of error.

Definition at line 2167 of file qgscomposerview.cpp.

◆ compositionSet

void QgsComposerView::compositionSet ( QgsComposition )
signal

Emitted when the composition is set for the view.

◆ copyItems()

void QgsComposerView::copyItems ( ClipboardMode  mode)

Cuts or copies the selected items.

Definition at line 1462 of file qgscomposerview.cpp.

◆ currentTool()

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

Definition at line 137 of file qgscomposerview.h.

◆ cursorPosChanged

void QgsComposerView::cursorPosChanged ( QPointF  )
signal

Is emitted when mouse cursor coordinates change.

◆ deleteSelectedItems()

void QgsComposerView::deleteSelectedItems ( )

Deletes selected items.

Definition at line 1553 of file qgscomposerview.cpp.

◆ groupItems()

void QgsComposerView::groupItems ( )

Add an item group containing the selected items.

Definition at line 2180 of file qgscomposerview.cpp.

◆ hideEvent()

void QgsComposerView::hideEvent ( QHideEvent *  e)
overrideprotected

Definition at line 2126 of file qgscomposerview.cpp.

◆ itemRemoved

void QgsComposerView::itemRemoved ( QgsComposerItem )
signal

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

◆ keyPressEvent()

void QgsComposerView::keyPressEvent ( QKeyEvent *  e)
overrideprotected

Definition at line 1673 of file qgscomposerview.cpp.

◆ keyReleaseEvent()

void QgsComposerView::keyReleaseEvent ( QKeyEvent *  e)
overrideprotected

Definition at line 1907 of file qgscomposerview.cpp.

◆ mapCanvas()

QgsMapCanvas * QgsComposerView::mapCanvas ( ) const

Returns the map canvas associated with the view.

See also
setMapCanvas()
Since
QGIS 3.0

Definition at line 2108 of file qgscomposerview.cpp.

◆ mouseDoubleClickEvent()

void QgsComposerView::mouseDoubleClickEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 1394 of file qgscomposerview.cpp.

◆ mouseMoveEvent()

void QgsComposerView::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 1161 of file qgscomposerview.cpp.

◆ mousePressEvent()

void QgsComposerView::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 164 of file qgscomposerview.cpp.

◆ mouseReleaseEvent()

void QgsComposerView::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 736 of file qgscomposerview.cpp.

◆ paintEvent()

void QgsComposerView::paintEvent ( QPaintEvent *  event)
overrideprotected

Definition at line 2113 of file qgscomposerview.cpp.

◆ paintingEnabled()

bool QgsComposerView::paintingEnabled ( ) const
inline

Definition at line 152 of file qgscomposerview.h.

◆ pasteItems()

void QgsComposerView::pasteItems ( PasteMode  mode)

Pastes items from clipboard.

Definition at line 1516 of file qgscomposerview.cpp.

◆ resizeEvent()

void QgsComposerView::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 2138 of file qgscomposerview.cpp.

◆ scaleSafe()

void QgsComposerView::scaleSafe ( double  scale)

Scales the view in a safe way, by limiting the acceptable range of the scale applied.

Parameters
scalefactor to scale view by
Since
QGIS 2.16

Definition at line 2075 of file qgscomposerview.cpp.

◆ scrollContentsBy()

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

Definition at line 2145 of file qgscomposerview.cpp.

◆ selectAll()

void QgsComposerView::selectAll ( )

Selects all items.

Definition at line 1602 of file qgscomposerview.cpp.

◆ selectedItemChanged

void QgsComposerView::selectedItemChanged ( QgsComposerItem selected)
signal

Is emitted when selected item changed. If 0, no item is selected.

◆ selectInvert()

void QgsComposerView::selectInvert ( )

Inverts current selection.

Definition at line 1642 of file qgscomposerview.cpp.

◆ selectNone()

void QgsComposerView::selectNone ( )

Deselects all items.

Definition at line 1632 of file qgscomposerview.cpp.

◆ setComposition()

void QgsComposerView::setComposition ( QgsComposition c)

Sets the composition for the view.

If the composition is being set manually and not by a QgsComposer, then this must be set BEFORE adding any items to the composition.

Definition at line 2151 of file qgscomposerview.cpp.

◆ setCurrentTool()

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

Definition at line 89 of file qgscomposerview.cpp.

◆ setHorizontalRuler()

void QgsComposerView::setHorizontalRuler ( QgsComposerRuler r)
inline

Definition at line 157 of file qgscomposerview.h.

◆ setMapCanvas()

void QgsComposerView::setMapCanvas ( QgsMapCanvas canvas)

Sets the map canvas associated with the view.

This allows the view to retrieve map settings from the canvas.

Since
QGIS 3.0
See also
mapCanvas()

Definition at line 2103 of file qgscomposerview.cpp.

◆ setPaintingEnabled()

void QgsComposerView::setPaintingEnabled ( bool  enabled)
inline

Definition at line 151 of file qgscomposerview.h.

◆ setPreviewMode()

void QgsComposerView::setPreviewMode ( QgsPreviewEffect::PreviewMode  mode)

Sets the preview mode which should be used to modify the view's appearance.

Preview modes are only used if setPreviewMode is set to true.

Parameters
modePreviewMode to be used to draw the view
Since
QGIS 2.3
See also
setPreviewModeEnabled

Definition at line 2093 of file qgscomposerview.cpp.

◆ setPreviewModeEnabled()

void QgsComposerView::setPreviewModeEnabled ( bool  enabled)

Sets whether a preview effect should be used to alter the view's appearance.

Parameters
enabledSet to true to enable the preview effect on the view
Since
QGIS 2.3
See also
setPreviewMode

Definition at line 2083 of file qgscomposerview.cpp.

◆ setVerticalRuler()

void QgsComposerView::setVerticalRuler ( QgsComposerRuler r)
inline

Definition at line 158 of file qgscomposerview.h.

◆ setZoomLevel()

void QgsComposerView::setZoomLevel ( double  zoomLevel)

Set zoom level, where a zoom level of 1.0 corresponds to 100%.

Definition at line 2059 of file qgscomposerview.cpp.

◆ showEvent()

void QgsComposerView::showEvent ( QShowEvent *  e)
overrideprotected

Definition at line 2132 of file qgscomposerview.cpp.

◆ ungroupItems()

void QgsComposerView::ungroupItems ( )

Ungroups the selected items.

Definition at line 2201 of file qgscomposerview.cpp.

◆ updateRulers()

void QgsComposerView::updateRulers ( )

Update rulers with current scene rect.

Definition at line 571 of file qgscomposerview.cpp.

◆ wheelEvent()

void QgsComposerView::wheelEvent ( QWheelEvent *  event)
overrideprotected

Definition at line 1955 of file qgscomposerview.cpp.

◆ zoomLevelChanged

void QgsComposerView::zoomLevelChanged ( )
signal

Is emitted when the view zoom changes.


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