[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/libs/widgets
From:       Gilles Caulier <caulier.gilles () free ! fr>
Date:       2005-12-16 12:01:33
Message-ID: 1134734493.192079.9716.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 488910 by cgilles:

Digikam from trunk : Curves widget display point position in curves area to optimize \
layout in CurvesAdjust plugin dialog

 M  +26 -8     curveswidget.cpp  
 M  +2 -0      curveswidget.h  


--- trunk/extragear/graphics/digikam/libs/widgets/curveswidget.cpp #488909:488910
@@ -73,7 +73,9 @@
     m_readOnlyMode   = readOnly;
     m_guideVisible   = false;
     m_sixteenBits    = i_sixteenBits;
-
+    m_xMouseOver     = -1;
+    m_yMouseOver     = -1;
+   
     setMouseTracking(true);
     setPaletteBackgroundColor(Qt::NoBackground);
     setMinimumSize(w, h);
@@ -295,9 +297,7 @@
              
       do
       {
-          double v;
-
-          v  = 0.0;
+          double v = 0.0;
           
           switch(m_channelType)
           {
@@ -404,9 +404,22 @@
    p1.drawLine(0, wHeight/3, wWidth, wHeight/3);                 
    p1.drawLine(0, 2*wHeight/3, wWidth, 2*wHeight/3);     
             
+   // Drawing X,Y point position draged by mouse over widget.
+   
+   p1.setPen(QPen::QPen(Qt::black, 1, Qt::DotLine));      
+
+   if (m_xMouseOver != -1 && m_yMouseOver != -1)
+   {
+        QString string = i18n("x:%1\ny:%2").arg(m_xMouseOver).arg(m_yMouseOver);
+        QFontMetrics fontMt( string );
+        QRect rect = fontMt.boundingRect(0, 0, wWidth, wHeight, 0, string);
+        rect.moveRight(wWidth);
+        rect.moveBottom(wHeight);
+        p1.drawText(rect, Qt::AlignLeft||Qt::AlignTop, string);
+   }
+
    // Drawing color guide.
 
-   p1.setPen(QPen::QPen(Qt::black, 1, Qt::DotLine));      
    int guidePos;
 
    if (m_guideVisible)   
@@ -675,14 +688,19 @@
          break;
       }
    }
-   
-   emit signalMouseMoved(x, m_imageHistogram->getHistogramSegment()-1 - y);
+
+   m_xMouseOver = x;
+   m_yMouseOver = m_imageHistogram->getHistogramSegment()-1 - y;
+   emit signalMouseMoved(m_xMouseOver, m_yMouseOver);
    repaint(false);
 }
 
 void CurvesWidget::leaveEvent( QEvent * )
 {
-      emit signalMouseMoved(-1, -1);
+   m_xMouseOver = -1;
+   m_yMouseOver = -1;
+   emit signalMouseMoved(m_xMouseOver, m_yMouseOver);
+   repaint(false);
 }
 
 }  // NameSpace Digikam
--- trunk/extragear/graphics/digikam/libs/widgets/curveswidget.h #488909:488910
@@ -119,6 +119,8 @@
     int                   m_rightmost;
     int                   m_grab_point;
     int                   m_last;
+    int                   m_xMouseOver;
+    int                   m_yMouseOver;
     
     bool                  m_sixteenBits;    
     bool                  m_blinkFlag;         


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic