QgisApp Class Reference

#include <qgisapp.h>

Collaboration diagram for QgisApp:

Collaboration graph
[legend]
List of all members.

Detailed Description

Main window for the Qgis application.

Definition at line 69 of file qgisapp.h.

Public Slots

void zoomFull ()
 Zoom to full extent.
void zoomToPrevious ()
 Zoom to the previous extent.
void zoomToSelected ()
 Zoom to selected features.
void editCut (QgsMapLayer *layerContainingSelection=0)
 
Parameters:
layerContainingSelection The layer that the selection will be taken from (defaults to the active layer on the legend)

void editCopy (QgsMapLayer *layerContainingSelection=0)
 
Parameters:
layerContainingSelection The layer that the selection will be taken from (defaults to the active layer on the legend)

void editPaste (QgsMapLayer *destinationLayer=0)
 
Parameters:
destinationLayer The layer that the clipboard will be pasted to (defaults to the active layer on the legend)


Signals

void keyPressed (QKeyEvent *e)
 emitted when a key is pressed and we want non widget sublasses to be able to pick up on this (e.g.
void projectRead ()
 emitted when a project file is successfully read
void newProject ()
 emitted when starting an entirely new project
void bookmarkAdded ()
 emitted when a new bookmark is added

Public Member Functions

 QgisApp (QSplashScreen *splash, QWidget *parent=0, Qt::WFlags fl=Qt::Window)
 Constructor.
 ~QgisApp ()
 Destructor.
QgsVectorLayeraddVectorLayer (QString vectorLayerPath, QString baseName, QString providerKey)
 Add a vector layer to the canvas, returns pointer to it.
bool addVectorLayers (QStringList const &theLayerQStringList, const QString &enc)
 overloaded vesion of the privat addLayer method that takes a list of file names instead of prompting user with a dialog.
bool addRasterLayers (QStringList const &theLayerQStringList, bool guiWarning=true)
 overloaded vesion of the private addRasterLayer() Method that takes a list of file names instead of prompting user with a dialog.
QgsRasterLayeraddRasterLayer (QString const &rasterLayerPath, QString const &baseName, QString const &providerKey, QStringList const &layers, QStringList const &styles, QString const &format, QString const &crs)
 Open a raster layer using the Raster Data Provider.
QgsRasterLayeraddRasterLayer (QString const &rasterFile, QString const &baseName, bool guiWarning=true)
 open a raster layer for the given file
void addMapLayer (QgsMapLayer *theMapLayer)
 Add a 'pre-made' map layer to the project.
void setExtent (QgsRect theRect)
 Set the extents of the map canvas.
void removeAllLayers ()
 Remove all layers from the map and legend - reimplements same method from qgisappbase.
bool openLayer (const QString &fileName)
 Open a raster or vector file; ignore other files.
void openProject (const QString &fileName)
 Open the specified project file; prompt to save previous project if necessary.
bool addProject (QString projectFile)
 opens a qgis project file
void saveMapAsImage (QString, QPixmap *)
 Overloaded version of the private function with same name that takes the imagename as a parameter.
QgsMapCanvasmapCanvas ()
 Get the mapcanvas object from the app.
void setTheme (QString themeName="default")
 Set theme (icons).
void setupToolbarPopups (QString themeName)
 Setup the toolbar popup menus for a given theme.
QgsClipboardclipboard ()
 Returns a pointer to the internal clipboard.
void setupProxy ()
 Setup the proxy settings from the QSettings environment.
void addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget)
 Add a dock widget to the main window.
QToolBar * addToolBar (QString name)
 Add a toolbar to the main window.
void addWindow (QAction *action)
 Add window to Window menu.
void removeWindow (QAction *action)
 Remove window from Window menu.
QAction * actionNewProject ()
 Actions to be inserted in menus and toolbars.
QAction * actionOpenProject ()
QAction * actionFileSeparator1 ()
QAction * actionSaveProject ()
QAction * actionSaveProjectAs ()
QAction * actionSaveMapAsImage ()
QAction * actionFileSeparator2 ()
QAction * actionProjectProperties ()
QAction * actionFileSeparator3 ()
QAction * actionPrintComposer ()
QAction * actionFileSeparator4 ()
QAction * actionExit ()
QAction * actionCutFeatures ()
QAction * actionCopyFeatures ()
QAction * actionPasteFeatures ()
QAction * actionEditSeparator1 ()
QAction * actionCapturePoint ()
QAction * actionCaptureLine ()
QAction * actionCapturePologon ()
QAction * actionDeleteSelected ()
QAction * actionMoveFeature ()
QAction * actionSplitFeatures ()
QAction * actionAddVertex ()
QAction * actionDelerteVertex ()
QAction * actioMoveVertex ()
QAction * actionAddRing ()
QAction * actionAddIsland ()
QAction * actionEditSeparator2 ()
QAction * actionPan ()
QAction * actionZoomIn ()
QAction * actionZoomOut ()
QAction * actionSelect ()
QAction * actionIdentify ()
QAction * actionMeasure ()
QAction * actionMeasureArea ()
QAction * actionViewSeparator1 ()
QAction * actionZoomFullExtent ()
QAction * actionZoomToLayer ()
QAction * actionZoomToSelected ()
QAction * actionZoomLast ()
QAction * actionZoomActualSize ()
QAction * actionViewSeparator2 ()
QAction * actionMapTips ()
QAction * actionNewBookmark ()
QAction * actionShowBookmarks ()
QAction * actionDraw ()
QAction * actionViewSeparator3 ()
QAction * actionNewVectorLayer ()
QAction * actionAddOgrLayer ()
QAction * actionAddRasterLayer ()
QAction * actionAddPgLayer ()
QAction * actionAddWmsLayer ()
QAction * actionLayerSeparator1 ()
QAction * actionOpenTable ()
QAction * actionToggleEditing ()
QAction * actionLayerSaveAs ()
QAction * actionLayerSelectionSaveAs ()
QAction * actionRemoveLayer ()
QAction * actionLayerProperties ()
QAction * actionLayerSeparator2 ()
QAction * actionAddToOverview ()
QAction * actionAddAllToOverview ()
QAction * actionRemoveAllFromOverview ()
QAction * actionLayerSeparator3 ()
QAction * actionHideAllLayers ()
QAction * actionShowAllLayers ()
QAction * actionManagePlugins ()
QAction * actionPluginSeparator1 ()
QAction * actionPluginListSeparator ()
QAction * actionPluginSeparator2 ()
QAction * actionPluginPythonSeparator ()
QAction * actionShowPythonDialog ()
QAction * actionToggleFullScreen ()
QAction * actionSettingsSeparator1 ()
QAction * actionOptions ()
QAction * actionCustomProjection ()
QAction * actionHelpContents ()
QAction * actionHelpSeparator1 ()
QAction * actionQgisHomePage ()
QAction * actionCheckQgisVersion ()
QAction * actionHelpSeparator2 ()
QAction * actionAbout ()
QMenu * fileMenu ()
 Menus.
QMenu * editMenu ()
QMenu * viewMenu ()
QMenu * layerMenu ()
QMenu * settingsMenu ()
QMenu * pluginMenu ()
QMenu * firstRightStandardMenu ()
QMenu * windowMenu ()
QMenu * helpMenu ()
QToolBar * fileToolBar ()
 Get a reference to a toolbar.
QToolBar * layerToolBar ()
QToolBar * mapNavToolToolBar ()
QToolBar * digitizeToolBar ()
QToolBar * attributesToolBar ()
QToolBar * pluginToolBar ()
QToolBar * helpToolBar ()

Static Public Member Functions

static QgisAppinstance ()
static QIcon getThemeIcon (const QString theName)
 Helper to get a theme icon. It will fall back to the.
static QPixmap getThemePixmap (const QString theName)
 Helper to get a theme icon as a pixmap. It will fall back to the.

Protected Member Functions

virtual void changeEvent (QEvent *event)
 Handle state changes (WindowTitleChange).
virtual void closeEvent (QCloseEvent *event)
 Have some control over closing of the application.
virtual void dragEnterEvent (QDragEnterEvent *event)
virtual void dropEvent (QDropEvent *event)
virtual void keyPressEvent (QKeyEvent *event)
 reimplements widget keyPress event so we can check if cancel was pressed

Private Slots

void about ()
 About QGis.
void addRasterLayer ()
 Add a raster layer to the map (will prompt user for file name using dlg ).
void addDatabaseLayer ()
 Add a databaselayer to the map.
void isInOverview ()
 toggles whether the current selected layer is in overview or not
void showMouseCoordinate (QgsPoint &)
 Slot to show the map coordinate position of the mouse cursor.
void showScale (double theScale)
 Slot to show current map scale;.
void userScale ()
 Slot to handle user scale input;.
void removeLayer ()
 Remove a layer from the map and legend.
void zoomToLayerExtent ()
 zoom to extent of layer
void zoomActualSize ()
 zoom to actual size of raster layer
void restoreSessionPlugins (QString thePluginDirString)
 load any plugins used in the last qgis session
void showPluginManager ()
 plugin manager
void loadPythonSupport ()
 load python support if possible
void loadPlugin (QString mFullPath, QString name)
 plugin loader
void loadPythonPlugin (QString packageName, QString pluginName)
 python plugin loader
QMenu * getPluginMenu (QString menuName)
 Find the QMenu with the given name (ie the user visible text on the menu item).
void addPluginToMenu (QString name, QAction *action)
 Add the action to the submenu with the given name under the plugin menu.
void removePluginMenu (QString name, QAction *action)
 Remove the action to the submenu with the given name under the plugin menu.
int addPluginToolBarIcon (QAction *qAction)
 Add an icon to the plugin toolbar.
void removePluginToolBarIcon (QAction *qAction)
 Remove an icon from the plugin toolbar.
void saveWindowState ()
 Save window state.
void restoreWindowState ()
 Restore the window and toolbar state.
bool fileSave ()
 Save project. Returns true if the user selected a file to save to, false if not.
void fileSaveAs ()
 Save project as.
void openProject (QAction *action)
 Open the project file corresponding to the text)= of the given action.
void saveMapAsImage ()
 Save the map view as an image - user is prompted for image name using a dialog.
void fileOpen ()
 Open a project.
void fileNew ()
 Create a new project.
void fileNew (bool thePromptToSaveFlag)
 As above but allows forcing without prompt.
void newVectorLayer ()
 Create a new empty vector layer.
void filePrint ()
 Print the current map view frame.
void addAllToOverview ()
 Add all loaded layers into the overview - overides qgisappbase method.
void removeAllFromOverview ()
 Remove all loaded layers from the overview - overides qgisappbase method.
void hideAllLayers ()
void showAllLayers ()
QgsMapLayeractiveLayer ()
 Return pointer to the active layer.
void helpContents ()
 Open the help contents in a browser.
void helpQgisHomePage ()
 Open the QGIS homepage in users browser.
void openURL (QString url, bool useQgisDocDirectory=true)
 Open a url in the users configured browser.
void checkQgisVersion ()
 Check qgis version against the qgis version server.
void customProjection ()
 Invoke the custom projection dialog.
void options ()
 options dialog slot
void whatsThis ()
 Whats-this help slot.
void socketConnected ()
void socketConnectionClosed ()
void socketReadyRead ()
void socketError (QAbstractSocket::SocketError e)
void projectProperties ()
 Set project properties, including map untis.
void projectPropertiesProjections ()
 Open project properties dialog and show the projections tab.
void showBookmarks ()
 Show the spatial bookmarks dialog.
void newBookmark ()
 Create a new spatial bookmark.
void capturePoint ()
 activates the capture point tool
void captureLine ()
 activates the capture line tool
void capturePolygon ()
 activates the capture polygon tool
void deleteSelected ()
 Deletes the selected attributes for the currently selected vector layer.
void moveFeature ()
 activates the move feature tool
void splitFeatures ()
 activates the split features tool
void addVertex ()
 activates the add vertex tool
void moveVertex ()
 activates the move vertex tool
void deleteVertex ()
 activates the delete vertex tool
void addRing ()
 activates the add ring tool
void addIsland ()
 activates the add island tool
void select ()
 activates the selection tool
void refreshMapCanvas ()
 refresh map canvas
QgsLegendlegend ()
 returns pointer to map legend
void toggleEditing ()
 starts/stops editing mode of the current layer
void mapToolChanged (QgsMapTool *tool)
 map tool changed
void activateDeactivateLayerRelatedActions (QgsMapLayer *layer)
 Activates or deactivates actions depending on the current maplayer type.
void showProgress (int theProgress, int theTotalSteps)
void extentsViewToggled (bool theFlag)
void showExtents ()
void showStatusMessage (QString theMessage)
void updateMouseCoordinatePrecision ()
void hasCrsTransformEnabled (bool theFlag)
void destinationSrsChanged ()
void addVectorLayer ()
 Add a vector layer to the map.
void fileExit ()
 Exit Qgis.
void addWmsLayer ()
 Add a WMS layer to the map.
void zoomOut ()
 Set map tool to Zoom out.
void zoomIn ()
 Set map tool to Zoom in.
void pan ()
 Set map tool to pan.
void identify ()
 Identify feature(s) on the currently selected layer.
void measure ()
 Measure distance.
void measureArea ()
 Measure area.
void attributeTable ()
 show the attribute table for the currently selected layer
void toggleEditing (QgsMapLayer *layer)
 starts/stops editing mode of a layer
void saveAsShapefile ()
 save current vector layer
void saveSelectionAsShapefile ()
void layerProperties ()
 open the properties dialog for the currently selected layer
void showPythonDialog ()
 show python console
void oldProjectVersionWarning (QString)
 Shows a warning when an old project file is read.
void toggleMapTips ()
 Toggle map tips on/off.
void showMapTip ()
 Show the map tip.
void toggleFullScreen ()
 Toggle full screen mode.
void showActiveWindowMinimized ()
 Set minimized mode of active window.
void toggleActiveWindowMaximized ()
 Toggle maximized mode of active window.
void activate ()
 Raise, unminimize and activate this window.
void bringAllToFront ()
 Bring forward all open windows.
void stopRendering ()
 Stops rendering of the main map.

Private Member Functions

bool addRasterLayer (QgsRasterLayer *theRasterLayer)
 Add a raster layer to the map (passed in as a ptr).
bool isValidVectorFileName (QString theFileNameQString)
 This helper checks to see whether the file name appears to be a valid vector file name.
bool isValidVectorFileName (QString *theFileNameQString)
 Overloaded version of the above function provided for convenience that takes a qstring pointer.
void saveRecentProjectPath (QString projectPath, QSettings &settings)
 add this file to the recently opened/saved projects list pass settings by reference since creating more than one instance simultaneously results in data loss.
void updateRecentProjectPaths ()
 Update file menu with the current list of recently accessed projects.
void pasteTransformations ()
 shows the paste-transformations dialog
bool saveDirty ()
 check to see if file is dirty and if so, prompt the user th save it
 QgisApp (QgisApp const &)
 QgisApp aren't copyable.
QgisAppoperator= (QgisApp const &)
 QgisApp aren't copyable.
void readSettings ()
void writeSettings ()
void createActions ()
void createActionGroups ()
void createMenus ()
void createToolBars ()
void createStatusBar ()
void setupConnections ()
void createLegend ()
void createOverview ()
void createCanvas ()
bool createDB ()
void createMapTips ()

Private Attributes

QToolBar * mFileToolBar
QToolBar * mLayerToolBar
QToolBar * mMapNavToolBar
QToolBar * mDigitizeToolBar
QToolBar * mAttributesToolBar
QToolBar * mPluginToolBar
QToolBar * mHelpToolBar
QAction * mActionNewProject
QAction * mActionOpenProject
QAction * mActionFileSeparator1
QAction * mActionSaveProject
QAction * mActionSaveProjectAs
QAction * mActionSaveMapAsImage
QAction * mActionFileSeparator2
QAction * mActionProjectProperties
QAction * mActionFileSeparator3
QAction * mActionPrintComposer
QAction * mActionFileSeparator4
QAction * mActionExit
QAction * mActionCutFeatures
QAction * mActionCopyFeatures
QAction * mActionPasteFeatures
QAction * mActionEditSeparator1
QAction * mActionCapturePoint
QAction * mActionCaptureLine
QAction * mActionCapturePolygon
QAction * mActionDeleteSelected
QAction * mActionMoveFeature
QAction * mActionSplitFeatures
QAction * mActionAddVertex
QAction * mActionDeleteVertex
QAction * mActionMoveVertex
QAction * mActionAddRing
QAction * mActionAddIsland
QAction * mActionEditSeparator2
QAction * mActionPan
QAction * mActionZoomIn
QAction * mActionZoomOut
QAction * mActionSelect
QAction * mActionIdentify
QAction * mActionMeasure
QAction * mActionMeasureArea
QAction * mActionViewSeparator1
QAction * mActionZoomFullExtent
QAction * mActionZoomToLayer
QAction * mActionZoomToSelected
QAction * mActionZoomLast
QAction * mActionZoomActualSize
QAction * mActionViewSeparator2
QAction * mActionMapTips
QAction * mActionNewBookmark
QAction * mActionShowBookmarks
QAction * mActionDraw
QAction * mActionViewSeparator3
QAction * mActionNewVectorLayer
QAction * mActionAddOgrLayer
QAction * mActionAddRasterLayer
QAction * mActionAddPgLayer
QAction * mActionAddWmsLayer
QAction * mActionLayerSeparator1
QAction * mActionOpenTable
QAction * mActionToggleEditing
QAction * mActionLayerSaveAs
QAction * mActionLayerSelectionSaveAs
QAction * mActionRemoveLayer
QAction * mActionLayerProperties
QAction * mActionLayerSeparator2
QAction * mActionAddToOverview
QAction * mActionAddAllToOverview
QAction * mActionRemoveAllFromOverview
QAction * mActionLayerSeparator3
QAction * mActionHideAllLayers
QAction * mActionShowAllLayers
QAction * mActionManagePlugins
QAction * mActionPluginSeparator1
QAction * mActionPluginSeparator2
QAction * mActionShowPythonDialog
QAction * mActionToggleFullScreen
QAction * mActionSettingsSeparator1
QAction * mActionOptions
QAction * mActionCustomProjection
QAction * mActionHelpContents
QAction * mActionHelpSeparator1
QAction * mActionQgisHomePage
QAction * mActionCheckQgisVersion
QAction * mActionHelpSeparator2
QAction * mActionAbout
QActionGroup * mMapToolGroup
QMenu * mFileMenu
QMenu * mEditMenu
QMenu * mRecentProjectsMenu
QMenu * mViewMenu
QMenu * mPanelMenu
QMenu * mToolbarMenu
QMenu * mLayerMenu
QMenu * mSettingsMenu
QMenu * mHelpMenu
QDockWidget * mLegendDock
QDockWidget * mOverviewDock
QgisApp::Tools mMapTools
QgsMapToolmNonEditMapTool
QLabel * mScaleLabel
 Widget that will live on the statusbar to display "scale 1:".
QLineEdit * mScaleEdit
 Widget that will live on the statusbar to display scale value.
QValidator * mScaleEditValidator
 The validator for the mScaleEdit.
QLabel * mCoordsLabel
 Widget that will live in the statusbar to display coords.
QProgressBar * mProgressBar
 Widget that will live in the statusbar to show progress of operations.
QCheckBox * mRenderSuppressionCBox
 Widget used to suppress rendering.
QToolButton * mToggleExtentsViewButton
 A toggle to switch between mouse coords and view extents display.
QToolButton * mStopRenderButton
 Button used to stop rendering.
QToolButton * mOnTheFlyProjectionStatusButton
 Widget in status bar used to show status of on the fly projection.
QMenu * mPopupMenu
 Popup menu.
QMenu * mPluginMenu
 Top level plugin menu.
QMenu * toolPopupOverviews
 Popup menu for the map overview tools.
QMenu * toolPopupDisplay
 Popup menu for the display tools.
QMenu * toolPopupCapture
 Popup menu for the capture tools.
QgsMapCanvasmMapCanvas
 Map canvas.
QgsLegendmMapLegend
 Table of contents (legend) for the map.
QCursor * mOverviewMapCursor
 Cursor for the overview map.
double mScaleFactor
 scale factor
QRect * mMapWindow
 Current map window extent in real-world coordinates.
int mPreviousNonZoomMapTool
 The previously selected non zoom map tool.
QString mStartupPath
QString mFullPathName
 full path name of the current map file (if it has been saved or loaded)
QgisAppInterfacemQgisInterface
 interface to QgisApp for plugins
QTcpSocket * mSocket
QString mVersionMessage
QSplashScreen * mSplash
QgsHelpViewermHelpViewer
 help viewer
QStringList mRecentProjectPaths
 list of recently opened/saved project files
QgsComposermComposer
 Map composer.
bool mMousePrecisionAutomatic
 How to determine the number of decimal places used to display the mouse position.
unsigned int mMousePrecisionDecimalPlaces
 The number of decimal places to use if not automatic.
QgsClipboardmInternalClipboard
 QGIS-internal vector feature clipboard.
bool mShowProjectionTab
 Flag to indicate how the project properties dialog was summoned.
QString mVectorFileFilter
 String containing supporting vector file formats Suitable for a QFileDialog file filter.
QString mRasterFileFilter
 String containing supporting raster file formats Suitable for a QFileDialog file filter.
QTimer * mpMapTipsTimer
 Timer for map tips.
QgsPoint mLastMapPosition
 Point of last mouse position in map coordinates (used with MapTips).
QgsMapTipmpMaptip
bool mMapTipsVisible
bool mFullScreenMode
 flag to indicate whether we are in fullscreen mode or not
bool mPrevScreenModeMaximized
 flag to indicate that the previous screen mode was 'maximised'
QgsPythonDialogmPythonConsole
QgsPythonUtilsmPythonUtils

Static Private Attributes

static QgisAppsmInstance

Friends

class QgisAppInterface

Classes

class  Tools


Constructor & Destructor Documentation

QgisApp::QgisApp ( QSplashScreen *  splash,
QWidget *  parent = 0,
Qt::WFlags  fl = Qt::Window 
)

Constructor.

Definition at line 309 of file qgisapp.cpp.

References activate(), addWindow(), QgsRasterLayer::buildSupportedRasterFileFilter(), buildSupportedVectorFileFilter_(),