00001 /*************************************************************************** 00002 qgsmaptip.h - Query a layer and show a maptip on the canvas 00003 --------------------- 00004 begin : October 2007 00005 copyright : (C) 2007 by Gary Sherman 00006 email : sherman @ mrcc dot com 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 #ifndef _QGSMAPTIP_H_ 00016 #define _QGSMAPTIP_H_ 00017 00018 class QgsMapLayer; 00019 class QgsMapCanvas; 00020 class QPoint; 00021 class QString; 00022 00023 00028 class GUI_EXPORT QgsMapTip 00029 { 00030 public: 00033 QgsMapTip(); 00036 virtual ~QgsMapTip(); 00046 void showMapTip( QgsMapLayer * thepLayer, 00047 QgsPoint & theMapPosition, 00048 QPoint & thePixelPosition, 00049 QgsMapCanvas *mpMapCanvas ); 00053 void clear( QgsMapCanvas *mpMapCanvas ); 00054 private: 00055 // Fetch the feature to use for the maptip text. Only the first feature in the 00056 // search radius is used 00057 QString fetchFeature( QgsMapLayer * thepLayer, 00058 QgsPoint & theMapPosition, 00059 QgsMapCanvas *thepMapCanvas ); 00060 // Flag to indicate if a maptip is currently being displayed 00061 bool mMapTipVisible; 00062 // Last point on the map canvas when the maptip timer fired. This point is in widget pixel 00063 // coordinates 00064 QPoint mLastPosition; 00065 00066 }; 00067 #endif // _QGSMAPTIP_H_