extragear/graphics/digikam/libs/widgets/common

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam/libs/widgets/common

Bugzilla from gustavo.boiko@kdemail.net
SVN commit 750486 by boiko:

Fix the hiding and showing of the cursor tracker tooltip, and also make it
X11-independent.
Use the same coding style all around the file (fixed some space/tab usage)

CCMAIL: [hidden email]


 M  +17 -22    dcursortracker.cpp  


--- trunk/extragear/graphics/digikam/libs/widgets/common/dcursortracker.cpp #750485:750486
@@ -38,7 +38,7 @@
 {
 
 DCursorTracker::DCursorTracker(const QString& txt, QWidget *parent)
-              : QLabel(txt, 0, Qt::X11BypassWindowManagerHint)
+              : QLabel(txt, 0, Qt::ToolTip )
 {
     parent->setMouseTracking(true);
     parent->installEventFilter(this);
@@ -50,8 +50,8 @@
  */
 void DCursorTracker::setText(const QString& txt)
 {
- QLabel::setText(txt);
- adjustSize();
+    QLabel::setText(txt);
+    adjustSize();
 }
 
 void DCursorTracker::setEnable(bool b)
@@ -61,15 +61,14 @@
 
 bool DCursorTracker::eventFilter(QObject *object, QEvent *e)
 {
- QWidget *widget = static_cast<QWidget*>(object);
-
- switch (e->type())
+    QWidget *widget = static_cast<QWidget*>(object);
+
+    switch (e->type())
     {
         case QEvent::MouseMove:
         {
             QMouseEvent *event = static_cast<QMouseEvent*>(e);
-            if (m_enable && (widget->rect().contains(event->pos()) ||
-                            (event->buttons() & Qt::LeftButton)))
+            if (m_enable)
             {
                 show();
                 QPoint p = widget->mapToGlobal(QPoint(widget->width()/2, 0));
@@ -81,32 +80,28 @@
             }
             break;
         }
-    
-        case QEvent::MouseButtonRelease:
+
+        case QEvent::Leave:
         {
-            QMouseEvent* event = static_cast<QMouseEvent*>(e);
-            if ( !widget->rect().contains(event->pos()) )
-            {
-                hide();
-            }
+            hide();
             break;
         }
-        
+
         default:
             break;
- }
+    }
 
- return false;
+    return false;
 }
 
 
 DTipTracker::DTipTracker(const QString& txt, QWidget *parent)
            : DCursorTracker(txt, parent)
 {
- setPalette(QToolTip::palette());
- setFrameStyle(QFrame::Plain | QFrame::Box);
- setLineWidth(1);
- setAlignment(Qt::AlignLeft | Qt::AlignTop);
+    setPalette(QToolTip::palette());
+    setFrameStyle(QFrame::Plain | QFrame::Box);
+    setLineWidth(1);
+    setAlignment(Qt::AlignLeft | Qt::AlignTop);
 }
 
 } // namespace Digikam
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel