QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsmaptip.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptip.h - Query a layer and show a maptip on the canvas
3  ---------------------
4  begin : October 2007
5  copyright : (C) 2007 by Gary Sherman
6  email : sherman @ mrcc dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef _QGSMAPTIP_H_
16 #define _QGSMAPTIP_H_
17 
18 class QgsMapLayer;
19 class QgsMapCanvas;
20 class QPoint;
21 class QString;
22 
23 #include "qgsfeature.h"
24 
29 class GUI_EXPORT QgsMapTip
30 {
31  public:
34  QgsMapTip();
37  virtual ~QgsMapTip();
47  void showMapTip( QgsMapLayer * thepLayer,
48  QgsPoint & theMapPosition,
49  QPoint & thePixelPosition,
50  QgsMapCanvas *mpMapCanvas );
54  void clear( QgsMapCanvas *mpMapCanvas );
55  private:
56  // Fetch the feature to use for the maptip text. Only the first feature in the
57  // search radius is used
58  QString fetchFeature( QgsMapLayer * thepLayer,
59  QgsPoint & theMapPosition,
60  QgsMapCanvas *thepMapCanvas );
61 
62  QString replaceText( QString displayText, QgsVectorLayer *layer, QgsFeature &feat );
63 
64  // Flag to indicate if a maptip is currently being displayed
66  // Last point on the map canvas when the maptip timer fired. This point is in widget pixel
67  // coordinates
68  QPoint mLastPosition;
69 
70 };
71 #endif // _QGSMAPTIP_H_
bool mMapTipVisible
Definition: qgsmaptip.h:65
Base class for all map layer types.
Definition: qgsmaplayer.h:47
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:104
A maptip is a class to display a tip on a map canvas when a mouse is hovered over a feature...
Definition: qgsmaptip.h:29
A class to represent a point geometry.
Definition: qgspoint.h:63
Represents a vector layer which manages a vector based data sets.
QPoint mLastPosition
Definition: qgsmaptip.h:68