SVN commit 1224505 by khudyakov: Make HOVER_INTERVAL static member in the SkyMap class instead of a define Fix documentation M +3 -13 skymap.cpp M +6 -12 skymap.h M +2 -1 skymapevents.cpp --- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #1224504:1224505 @@ -170,10 +170,9 @@ setupProjector(); //Initialize Transient label stuff - HoverTimer.setInterval( 500 ); - HoverTimer.setSingleShot( true ); // using this timer as a single shot timer + m_HoverTimer.setSingleShot( true ); // using this timer as a single shot timer - connect( &HoverTimer, SIGNAL( timeout() ), this, SLOT( slotTransientLabel() ) ); + connect( &m_HoverTimer, SIGNAL( timeout() ), this, SLOT( slotTransientLabel() ) ); connect( this, SIGNAL( destinationChanged() ), this, SLOT( slewFocus() ) ); // Time infobox @@ -341,15 +340,6 @@ //This function is only called if the HoverTimer manages to timeout. //(HoverTimer is restarted with every mouseMoveEvent; so if it times //out, that means there was no mouse movement for HOVER_INTERVAL msec.) - //Identify the object nearest to the mouse cursor as the - //TransientObject. The TransientObject is automatically labeled - //in SkyMap::paintEvent(). - //Note that when the TransientObject pointer is not NULL, the next - //mouseMoveEvent calls fadeTransientLabel(), which will fade out the - //TransientLabel and then set TransientObject to NULL. - // - //Do not show a transient label if the map is in motion, or if the mouse - //pointer is below the opaque horizon, or if the object has a permanent label if ( ! slewing && ! ( Options::useAltAz() && Options::showGround() && SkyPoint::refract(m_MousePoint.alt()).Degrees() < 0.0 ) ) { double maxrad = 1000.0/Options::zoomFactor(); @@ -898,7 +888,7 @@ //Start the HoverTimer. if the user leaves the mouse in place after a slew, //we want to attach a label to the nearest object. if ( Options::useHoverLabel() ) - HoverTimer.start( HOVER_INTERVAL ); + m_HoverTimer.start( HOVER_INTERVAL ); forceUpdate(); } --- trunk/KDE/kdeedu/kstars/kstars/skymap.h #1224504:1224505 @@ -34,8 +34,6 @@ #include -#define HOVER_INTERVAL 500 - class QPainter; class QPaintDevice; class QPixmap; @@ -511,14 +509,8 @@ virtual void resizeEvent( QResizeEvent * ); private slots: - /**@short attach transient label to object nearest the mouse cursor. - * This slot is connected to the timeout() signal of the HoverTimer, which is restarted - * in every mouseMoveEvent(). So this slot is executed only if the mouse does not move for - * HOVER_INTERVAL msec. It points TransientObject at the SkyObject nearest the - * mouse cursor, and the TransientObject is subsequently labeled in paintEvent(). - * Note that when TransientObject is not NULL, the next mouseMoveEvent() calls - * fadeTransientLabel(), which fades the label color and then sets TransientLabel to NULL. - * @sa mouseMoveEvent(), paintEvent(), slotTransientTimeout(), fadeTransientLabel() + /** @short display tooltip for object under cursor. It's called by m_HoverTimer. + * if mouse didn't moved for last HOVER_INTERVAL milliseconds. */ void slotTransientLabel(); @@ -613,8 +605,10 @@ SkyLine AngularRuler; //The line for measuring angles in the map QRect ZoomRect; //The manual-focus circle. - // data for transient object labels - QTimer HoverTimer; + // Mouse should not move for that interval to display tooltip + static const int HOVER_INTERVAL = 500; + // Timer for tooltips + QTimer m_HoverTimer; // InfoBoxes. Used in desctructor to save state InfoBoxWidget* m_timeBox; --- trunk/KDE/kdeedu/kstars/kstars/skymapevents.cpp #1224504:1224505 @@ -51,6 +51,7 @@ #include "skycomponents/starcomponent.h" + void SkyMap::resizeEvent( QResizeEvent * ) { computeSkymap = true; // skymap must be new computed @@ -414,7 +415,7 @@ //Start a single-shot timer to monitor whether we are currently hovering. //The idea is that whenever a moveEvent occurs, the timer is reset. It //will only timeout if there are no move events for HOVER_INTERVAL ms - HoverTimer.start( HOVER_INTERVAL ); + m_HoverTimer.start( HOVER_INTERVAL ); QToolTip::hideText(); }