QgsComposer Class Reference
[MapComposer]

#include <qgscomposer.h>

Collaboration diagram for QgsComposer:

Collaboration graph
[legend]
List of all members.

Detailed Description

A gui for composing a printable map.

Definition at line 45 of file qgscomposer.h.

Public Slots

void on_mActionZoomAll_activated (void)
 Zoom to full extent of the paper.
void on_mActionZoomIn_activated (void)
 Zoom in.
void on_mActionZoomOut_activated (void)
 Zoom out.
void on_mActionRefreshView_activated (void)
 Refresh view.
void on_mActionPrint_activated (void)
 Print the composition.
void on_mActionExportAsImage_activated (void)
 Print as image.
void on_mActionExportAsSVG_activated (void)
 Print as SVG.
void on_mActionSelectMoveItem_activated (void)
 Select item.
void on_mActionAddNewMap_activated (void)
 Add new map.
void on_mActionAddNewLegend_activated (void)
 Add new legend.
void on_mActionAddNewLabel_activated (void)
 Add new label.
void on_mActionAddNewScalebar_activated (void)
 Add new scalebar.
void on_mActionAddImage_activated (void)
 Add new picture.
void moveItemContent ()
 Set tool to move item content.
void groupItems (void)
 Group selected items.
void ungroupItems (void)
 Ungroup selected item group.
void raiseSelectedItems ()
 Move selected items one position up.
void lowerSelectedItems ()
 Move selected items one position down.
void moveSelectedItemsToTop ()
 Move selected items to top.
void moveSelectedItemsToBottom ()
 Move selected items to bottom.
void saveWindowState ()
 Save window state.
void on_helpPButton_clicked ()
 Slot for when the help button is clicked.
void on_closePButton_clicked ()
 Slot for when the close button is clicked.
void addComposerMap (QgsComposerMap *map)
 Add a composer map to the item/widget map and creates a configuration widget for it.
void addComposerLabel (QgsComposerLabel *label)
 Adds a composer label to the item/widget map and creates a configuration widget for it.
void addComposerScaleBar (QgsComposerScaleBar *scalebar)
 Adds a composer scale bar to the item/widget map and creates a configuration widget for it.
void addComposerLegend (QgsComposerLegend *legend)
 Adds a composer legend to the item/widget map and creates a configuration widget for it.
void addComposerPicture (QgsComposerPicture *picture)
 Adds a composer picture to the item/widget map and creates a configuration widget.
void deleteItem (QgsComposerItem *item)
 Removes item from the item/widget map and deletes the configuration widget.
void showItemOptions (const QgsComposerItem *i)
 Shows the configuration widget for a composer item.
void writeXML (QDomDocument &doc)
 Stores state in Dom node.
void readXML (const QDomDocument &doc)
 Sets state from Dom document.
void setSelectionTool ()

Public Member Functions

 QgsComposer (QgisApp *qgis)
 ~QgsComposer ()
void open ()
 Open and show, set defaults if first time.
void zoomFull ()
 Zoom to full extent of the paper.
QgsMapCanvasmapCanvas (void)
 Return pointer to map canvas.
QgsComposerViewview (void)
 Return pointer to composer view.
void showCompositionOptions (QWidget *w)
 Show composition options in widget.
void restoreWindowState ()
 Restore the window and toolbar state.

Protected Member Functions

virtual void moveEvent (QMoveEvent *)
 Move event.
virtual void resizeEvent (QResizeEvent *)
 Resize event.

Private Slots

void activate ()
 Raise, unminimize and activate this window.

Private Member Functions

void setupTheme ()
 Set the pixmap / icons on the toolbar buttons.
void connectSlots ()
 Establishes the signal slot connection for the class.
QMatrix updateMatrix (double scaleChange)
 returns new world matrix for canvas view after zoom with factor scaleChange
bool containsWMSLayer () const
 True if a composer map contains a WMS layer.
void showWMSPrintingWarning ()
 Displays a warning because of possible min/max size in WMS.

Private Attributes

QgsComposerViewmView
 Pointer to composer view.
QgsCompositionmComposition
 Current composition.
QPrinter * mPrinter
 Printer.
QgisAppmQgis
 Pointer to QGIS application.
bool mFirstTime
 The composer was opened first time (-> set defaults).
QGridLayout * mCompositionOptionsLayout
 Layout.
QGridLayout * mItemOptionsLayout
 Layout.
QSizeGrip * mSizeGrip
 Size grip.
QMap< QgsComposerItem *, QWidget * > mItemWidgetMap
 To know which item to show if selection changes.

Static Private Attributes

static const int context_id = 985715179
 Help context id.


Constructor & Destructor Documentation

QgsComposer::QgsComposer ( QgisApp qgis  ) 

Definition at line 66 of file qgscomposer.cpp.

References activate(), QgsApplication::activeThemePath(), connectSlots(), groupItems(), QgsProject::instance(), QgisApp::instance(), lowerSelectedItems(), QgisApp::mapCanvas(), QgsMapCanvas::mapRenderer(), mComposition, mCompositionOptionsLayout, mFirstTime, moveItemContent(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), mPrinter, mQgis, mSizeGrip, mView, QgsDebugMsg, raiseSelectedItems(), readXML(), restoreWindowState(), QgsComposerView::setComposition(), setSelectionTool(), setupTheme(), ungroupItems(), and writeXML().

QgsComposer::~QgsComposer (  ) 

Definition at line 239 of file qgscomposer.cpp.


Member Function Documentation

void QgsComposer::open (  ) 

Open and show, set defaults if first time.

Definition at line 274 of file qgscomposer.cpp.

References activate(), mFirstTime, and zoomFull().

Referenced by QgisApp::filePrint().

void QgsComposer::zoomFull (  ) 

Zoom to full extent of the paper.

Definition at line 389 of file qgscomposer.cpp.

References mComposition, mView, QgsComposition::paperHeight(), and QgsComposition::paperWidth().

Referenced by on_mActionZoomAll_activated(), and open().

QgsMapCanvas * QgsComposer::mapCanvas ( void   ) 

Return pointer to map canvas.

Definition at line 374 of file qgscomposer.cpp.

References QgisApp::mapCanvas(), and mQgis.

QgsComposerView * QgsComposer::view ( void   ) 

Return pointer to composer view.

Definition at line 379 of file qgscomposer.cpp.

References mView.

void QgsComposer::showCompositionOptions ( QWidget *  w  ) 

Show composition options in widget.

Definition at line 337 of file qgscomposer.cpp.

void QgsComposer::restoreWindowState (  ) 

Restore the window and toolbar state.

Definition at line 816 of file qgscomposer.cpp.

Referenced by QgsComposer().

void QgsComposer::moveEvent ( QMoveEvent *   )  [protected, virtual]

Move event.

Definition at line 799 of file qgscomposer.cpp.

References saveWindowState().

void QgsComposer::resizeEvent ( QResizeEvent *   )  [protected, virtual]

Resize event.

Definition at line 801 of file qgscomposer.cpp.

References mSizeGrip, and saveWindowState().

void QgsComposer::on_mActionZoomAll_activated ( void   )  [slot]

Zoom to full extent of the paper.

Definition at line 397 of file qgscomposer.cpp.

References zoomFull().

void QgsComposer::on_mActionZoomIn_activated ( void   )  [slot]

Zoom in.

Definition at line 402 of file qgscomposer.cpp.

References mView.

void QgsComposer::on_mActionZoomOut_activated ( void   )  [slot]

Zoom out.

Definition at line 408 of file qgscomposer.cpp.

References mView.

void QgsComposer::on_mActionRefreshView_activated ( void   )  [slot]

Refresh view.

Definition at line 414 of file qgscomposer.cpp.

References mComposition.

void QgsComposer::on_mActionPrint_activated ( void   )  [slot]

Print the composition.

Definition at line 422 of file qgscomposer.cpp.

References containsWMSLayer(), mComposition, QgsComposition::paperHeight(), QgsComposition::paperWidth(), QgsComposition::Print, and showWMSPrintingWarning().

void QgsComposer::on_mActionExportAsImage_activated ( void   )  [slot]

Print as image.

Definition at line 484 of file qgscomposer.cpp.

References containsWMSLayer(), mComposition, mView, QgsComposition::paperHeight(), QgsComposition::paperWidth(), QgsComposition::Preview, QgsComposition::Print, QgsComposition::printoutResolution(), QgsDebugMsg, QgsComposition::setPlotStyle(), and showWMSPrintingWarning().

void QgsComposer::on_mActionExportAsSVG_activated ( void   )  [slot]

Print as SVG.

Definition at line 610 of file qgscomposer.cpp.

References containsWMSLayer(), mComposition, QgsComposition::paperHeight(), QgsComposition::paperWidth(), QgsComposition::Preview, QgsComposition::Print, QgsMessageViewer::setCheckBoxQSettingsLabel(), QgsMessageViewer::setCheckBoxState(), QgsMessageViewer::setCheckBoxText(), QgsMessageViewer::setCheckBoxVisible(), QgsMessageViewer::setMessageAsHtml(), QgsComposition::setPlotStyle(), and showWMSPrintingWarning().

void QgsComposer::on_mActionSelectMoveItem_activated ( void   )  [slot]

Select item.

Definition at line 695 of file qgscomposer.cpp.

References mView, QgsComposerView::Select, and QgsComposerView::setCurrentTool().

Referenced by setSelectionTool().

void QgsComposer::on_mActionAddNewMap_activated ( void   )  [slot]

Add new map.

Definition at line 703 of file qgscomposer.cpp.

References QgsComposerView::AddMap, mView, and QgsComposerView::setCurrentTool().

void QgsComposer::on_mActionAddNewLegend_activated ( void   )  [slot]

Add new legend.

Definition at line 711 of file qgscomposer.cpp.

References QgsComposerView::AddLegend, mView, and QgsComposerView::setCurrentTool().

void QgsComposer::on_mActionAddNewLabel_activated ( void   )  [slot]

Add new label.

Definition at line 719 of file qgscomposer.cpp.

References QgsComposerView::AddLabel, mView, and QgsComposerView::setCurrentTool().

void QgsComposer::on_mActionAddNewScalebar_activated ( void   )  [slot]

Add new scalebar.

Definition at line 727 of file qgscomposer.cpp.

References QgsComposerView::AddScalebar, mView, and QgsComposerView::setCurrentTool().

void QgsComposer::on_mActionAddImage_activated ( void   )  [slot]

Add new picture.

Definition at line 735 of file qgscomposer.cpp.

References QgsComposerView::AddPicture, mView, and QgsComposerView::setCurrentTool().

void QgsComposer::moveItemContent (  )  [slot]

Set tool to move item content.

Definition at line 743 of file qgscomposer.cpp.

References QgsComposerView::MoveItemContent, mView, and QgsComposerView::setCurrentTool().

Referenced by QgsComposer().

void QgsComposer::groupItems ( void   )  [slot]

Group selected items.

Definition at line 751 of file qgscomposer.cpp.

References QgsComposerView::groupItems(), and mView.

Referenced by QgsComposer().

void QgsComposer::ungroupItems ( void   )  [slot]

Ungroup selected item group.

Definition at line 759 of file qgscomposer.cpp.

References mView, and QgsComposerView::ungroupItems().

Referenced by QgsComposer().

void QgsComposer::raiseSelectedItems (  )  [slot]

Move selected items one position up.

Definition at line 767 of file qgscomposer.cpp.

References mComposition, and QgsComposition::raiseSelectedItems().

Referenced by QgsComposer().

void QgsComposer::lowerSelectedItems (  )  [slot]

Move selected items one position down.

Definition at line 775 of file qgscomposer.cpp.

References QgsComposition::lowerSelectedItems(), and mComposition.

Referenced by QgsComposer().

void QgsComposer::moveSelectedItemsToTop (  )  [slot]

Move selected items to top.

Definition at line 783 of file qgscomposer.cpp.

References mComposition, and QgsComposition::moveSelectedItemsToTop().

Referenced by QgsComposer().

void QgsComposer::moveSelectedItemsToBottom (  )  [slot]

Move selected items to bottom.

Definition at line 791 of file qgscomposer.cpp.

References mComposition, and QgsComposition::moveSelectedItemsToBottom().

Referenced by QgsComposer().

void QgsComposer::saveWindowState (  )  [slot]

Save window state.

Definition at line 809 of file qgscomposer.cpp.

Referenced by moveEvent(), and resizeEvent().

void QgsComposer::on_helpPButton_clicked (  )  [slot]

Slot for when the help button is clicked.

Definition at line 833 of file qgscomposer.cpp.

References context_id, and QgsContextHelp::run().

void QgsComposer::on_closePButton_clicked (  )  [slot]

Slot for when the close button is clicked.

Definition at line 838 of file qgscomposer.cpp.

void QgsComposer::addComposerMap ( QgsComposerMap map  )  [slot]

Add a composer map to the item/widget map and creates a configuration widget for it.

Definition at line 1016 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::addComposerLabel ( QgsComposerLabel label  )  [slot]

Adds a composer label to the item/widget map and creates a configuration widget for it.

Definition at line 1027 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::addComposerScaleBar ( QgsComposerScaleBar scalebar  )  [slot]

Adds a composer scale bar to the item/widget map and creates a configuration widget for it.

Definition at line 1038 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::addComposerLegend ( QgsComposerLegend legend  )  [slot]

Adds a composer legend to the item/widget map and creates a configuration widget for it.

Definition at line 1049 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::addComposerPicture ( QgsComposerPicture picture  )  [slot]

Adds a composer picture to the item/widget map and creates a configuration widget.

Definition at line 1060 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::deleteItem ( QgsComposerItem item  )  [slot]

Removes item from the item/widget map and deletes the configuration widget.

Definition at line 1071 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots().

void QgsComposer::showItemOptions ( const QgsComposerItem i  )  [slot]

Shows the configuration widget for a composer item.

Definition at line 344 of file qgscomposer.cpp.

References mItemWidgetMap.

Referenced by connectSlots(), and readXML().

void QgsComposer::writeXML ( QDomDocument &  doc  )  [slot]

Stores state in Dom node.

Definition at line 843 of file qgscomposer.cpp.

References mComposition, mItemWidgetMap, and QgsComposition::writeXML().

Referenced by QgsComposer().

void QgsComposer::readXML ( const QDomDocument &  doc  )  [slot]

Sets state from Dom document.

Definition at line 878 of file qgscomposer.cpp.

References addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), connectSlots(), QgisApp::mapCanvas(), QgsMapCanvas::mapRenderer(), mComposition, mCompositionOptionsLayout, mQgis, mView, QgsComposerPicture::readXML(), QgsComposerLegend::readXML(), QgsComposerScaleBar::readXML(), QgsComposerMap::readXML(), QgsComposerLabel::readXML(), QgsComposition::readXML(), QgsComposerView::setComposition(), QgsComposerItem::setSelected(), setSelectionTool(), showItemOptions(), and QgsComposition::sortZList().

Referenced by QgsComposer().

void QgsComposer::setSelectionTool (  )  [slot]

Definition at line 1084 of file qgscomposer.cpp.

References on_mActionSelectMoveItem_activated().

Referenced by connectSlots(), QgsComposer(), and readXML().

void QgsComposer::activate (  )  [private, slot]

Raise, unminimize and activate this window.

Definition at line 292 of file qgscomposer.cpp.

Referenced by open(), and QgsComposer().

void QgsComposer::setupTheme (  )  [private]

Set the pixmap / icons on the toolbar buttons.

Definition at line 243 of file qgscomposer.cpp.

References QgisApp::getThemeIcon().

Referenced by QgsComposer().

void QgsComposer::connectSlots (  )  [private]

Establishes the signal slot connection for the class.

Definition at line 262 of file qgscomposer.cpp.

References addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), deleteItem(), mView, setSelectionTool(), and showItemOptions().

Referenced by QgsComposer(), and readXML().

QMatrix QgsComposer::updateMatrix ( double  scaleChange  )  [private]

returns new world matrix for canvas view after zoom with factor scaleChange

bool QgsComposer::containsWMSLayer (  )  const [private]

True if a composer map contains a WMS layer.

Definition at line 1090 of file qgscomposer.cpp.

References QgsComposerMap::containsWMSLayer(), and mItemWidgetMap.

Referenced by on_mActionExportAsImage_activated(), on_mActionExportAsSVG_activated(), and on_mActionPrint_activated().

void QgsComposer::showWMSPrintingWarning (  )  [private]

Displays a warning because of possible min/max size in WMS.

Definition at line 1111 of file qgscomposer.cpp.

References QgsMessageOutput::MessageText, QgsMessageViewer::setCheckBoxQSettingsLabel(), QgsMessageViewer::setCheckBoxState(), QgsMessageViewer::setCheckBoxText(), QgsMessageViewer::setCheckBoxVisible(), and QgsMessageViewer::setMessage().

Referenced by on_mActionExportAsImage_activated(), on_mActionExportAsSVG_activated(), and on_mActionPrint_activated().


Member Data Documentation

QgsComposerView* QgsComposer::mView [private]

Pointer to composer view.

Definition at line 214 of file qgscomposer.h.

Referenced by connectSlots(), groupItems(), moveItemContent(), on_mActionAddImage_activated(), on_mActionAddNewLabel_activated(), on_mActionAddNewLegend_activated(), on_mActionAddNewMap_activated(), on_mActionAddNewScalebar_activated(), on_mActionExportAsImage_activated(), on_mActionSelectMoveItem_activated(), on_mActionZoomIn_activated(), on_mActionZoomOut_activated(), QgsComposer(), readXML(), ungroupItems(), view(), and zoomFull().

QgsComposition* QgsComposer::mComposition [private]

Current composition.

Definition at line 217 of file qgscomposer.h.

Referenced by lowerSelectedItems(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), on_mActionExportAsImage_activated(), on_mActionExportAsSVG_activated(), on_mActionPrint_activated(), on_mActionRefreshView_activated(), QgsComposer(), raiseSelectedItems(), readXML(), writeXML(), and zoomFull().

QPrinter* QgsComposer::mPrinter [private]

Printer.

Definition at line 220 of file qgscomposer.h.

Referenced by QgsComposer().

QgisApp* QgsComposer::mQgis [private]

Pointer to QGIS application.

Definition at line 223 of file qgscomposer.h.

Referenced by mapCanvas(), QgsComposer(), and readXML().

bool QgsComposer::mFirstTime [private]

The composer was opened first time (-> set defaults).

Definition at line 226 of file qgscomposer.h.

Referenced by open(), and QgsComposer().

QGridLayout* QgsComposer::mCompositionOptionsLayout [private]

Layout.

Definition at line 229 of file qgscomposer.h.

Referenced by QgsComposer(), and readXML().

QGridLayout* QgsComposer::mItemOptionsLayout [private]

Layout.

Definition at line 232 of file qgscomposer.h.

QSizeGrip* QgsComposer::mSizeGrip [private]

Size grip.

Definition at line 235 of file qgscomposer.h.

Referenced by QgsComposer(), and resizeEvent().

QMap<QgsComposerItem*, QWidget*> QgsComposer::mItemWidgetMap [private]

To know which item to show if selection changes.

Definition at line 238 of file qgscomposer.h.

Referenced by addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), containsWMSLayer(), deleteItem(), showItemOptions(), and writeXML().

const int QgsComposer::context_id = 985715179 [static, private]

Help context id.

Definition at line 246 of file qgscomposer.h.

Referenced by on_helpPButton_clicked().


The documentation for this class was generated from the following files:
Generated on Tue Oct 28 16:51:54 2008 for Quantum GIS API Documentation by  doxygen 1.5.1