Salome HOME
#18963 Minimize compiler warnings
[modules/gui.git] / src / GLViewer / GLViewer_ToolTip.cxx
index a16897493630be235133c88b0e92d5e52a2d0f13..895d3bfdc0654b11380da370d311fac3e5c52be3 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-//  Author : OPEN CASCADE
-// File:      GLViewer_ToolTip.xx
-// Created:   March, 2005
-//#include "GLViewerAfx.h"
-//
 #include "GLViewer_Context.h"
 #include "GLViewer_ToolTip.h"
 #include "GLViewer_Viewer2d.h"
 */
 GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent )
 :QObject(),
- myText(),
  myPoint( -1, -1 )
 {
   mypViewPort = theParent;
-  //mypLabel = NULL;
   mypLabel = new QLabel( "Test", NULL, 
                          Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool | Qt::X11BypassWindowManagerHint );
   mypLabel->setObjectName("ObjectTipText");
   mypLabel->setMargin( 1 );
-  //mypLabel->setAutoMask( false );
   mypLabel->setFrameStyle( QFrame::Plain | QFrame::Box );
   mypLabel->setLineWidth( 1 );
   mypLabel->setAlignment( Qt::AlignAbsolute | Qt::AlignTop );
   mypLabel->setIndent( 0 );
   mypLabel->ensurePolished();
   
-  //mypLabel->setPalette( QToolTip::palette() );
-
   mypTimer = new QTimer( this );
 
   connect( mypTimer, SIGNAL( timeout() ), this, SLOT( showTip() ) );
@@ -71,15 +61,8 @@ GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent )
 */
 GLViewer_ObjectTip::~GLViewer_ObjectTip()
 { 
-//  delete mypRect;
   if( mypLabel )
     delete mypLabel;
-
-  //if( mypPoint )
-  //  delete mypPoint;
-
-  //if( mypTimer )
-  //  delete mypTimer;
 }
 
 
@@ -87,29 +70,9 @@ GLViewer_ObjectTip::~GLViewer_ObjectTip()
   It is called when there is a possibility that a tool tip should be shown
   \param p - position of tooltip
 */
-bool GLViewer_ObjectTip::maybeTip( const QPoint &p )
+bool GLViewer_ObjectTip::maybeTip( const QPoint& /*p*/ )
 {
-
-
   GLViewer_Context* aContext = ((GLViewer_Viewer2d*)mypViewPort->getViewFrame()->getViewer())->getGLContext();
-
-  /*if( !aContext->currentObjectIsChanged() )
-    return false;
-  else
-    return true;
-  if( myPoint.x() == -1 && myPoint.y() == -1 || aContext->currentObjectIsChanged())
-  {
-    myPoint = p;
-  }
-  else/if( abs(myPoint.y() - p.y()) < 16 )
-  {
-    return;
-  }
-  else // > 16
-  {
-    myPoint = p;
-  }
-*/  
   GLViewer_Object* anObj = aContext->getCurrentObject();
   if( anObj )
   {
@@ -118,20 +81,6 @@ bool GLViewer_ObjectTip::maybeTip( const QPoint &p )
   }
 
   return false;
-  /*if( anObj )
-  {
-    //GLViewer_Rect* aRect = anObj->getRect();
-    //QRect aWinRect = mypViewPort->GLV2win( *aRect );
-    tip( QRect( p.x(), p.y(), 1, 1 ), anObj->getName() );
-    //QFontMetrics aFM( font() );    
-     //showTip( aWinRect, anObj->getName(), QRect( 0, 0, aFM.width( anObj->getName() + "  " ), aFM.height()*1.5 ) );
-    //tip( aWinRect, anObj->getName(), aWinRect( aFM.width( anObj->getName() + "  " ), aFM.height()*1.5 )  );
-  }
-//  else
-//    clear();
-    
-  //tip( QRect( 0, 0, mypViewPort->getGLWidget()->width(),mypViewPort->getGLWidget()->height() ) , "test Tool tip" );
-  */
 }
 
 /*!
@@ -142,34 +91,20 @@ bool GLViewer_ObjectTip::eventFilter( QObject* theObj, QEvent* e )
   hideTipAndSleep();
   switch( e->type() )
   {
-    /*case QEvent::MouseButtonPress:
-    case QEvent::MouseButtonRelease:
-    case QEvent::MouseButtonDblClick:
-    case QEvent::KeyPress:
-    case QEvent::KeyRelease:
-            // input - turn off tool tip mode
-            hideTipAndSleep();
-            break;*/
     case QEvent::MouseMove:
+    {
+      QWidget* aWidget = (QWidget*) theObj;
+      if( aWidget == mypViewPort->getGLWidget() )
       {
-        //hideTipAndSleep();
-        /*if( mypTimer->isActive() )
-        {
-          mypTimer->Stop();
-          wakeUp();
-        }*/
-        QWidget* aWidget = (QWidget*) theObj;
-        if( aWidget == mypViewPort->getGLWidget() )
-        {
-          wakeup();
-          QMouseEvent* m = (QMouseEvent *)e;
-          //if( !mypPoint )
-          //  mypPoint = new QPoint();
-
-          myPoint.setX( m->x() );
-          myPoint.setY( m->y() );
-        }
+        wakeup();
+        QMouseEvent* m = (QMouseEvent *)e;
+
+        myPoint.setX( m->x() );
+        myPoint.setY( m->y() );
       }
+    }
+    default:
+      break;
   }
   return false;
 }
@@ -179,15 +114,12 @@ bool GLViewer_ObjectTip::eventFilter( QObject* theObj, QEvent* e )
 */
 void GLViewer_ObjectTip::hideTipAndSleep()
 {
-  //if( mypPoint )
-  //  delete mypPoint;
   myPoint.setX(-1);
   myPoint.setY(-1);
 
   if( mypLabel )
   {
     mypLabel->hide();
-    //delete mypLabel;
   }
   mypTimer->stop();
 }
@@ -205,7 +137,6 @@ void GLViewer_ObjectTip::showTip()
     
     QPoint pos = mypViewPort->getGLWidget()->mapToGlobal( myPoint );
     
-    //mypLabel->show();
     int cur_height = 24;
     QCursor* aCursor = QApplication::overrideCursor();
     if( aCursor )