Bug 88805

Summary: Digikam: wish: popup image information only when over the thumbnail
Product: [Applications] digikam Reporter: Achim Bohnet <ach>
Component: Thumbs-ImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: digikam-bugs-null
Priority: NOR    
Version: 0.7.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Achim Bohnet 2004-09-04 01:04:19 UTC
Version:           0.7.0-cvs (using KDE 3.2.3,  (3.1))
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-7)
OS:                Linux (i686) release 2.6.8-ach-1-686

I really like the image infos in the popup of the thumbnail
view but sometimes it gets irretaging but currently it hard
to place the cursor so no image info pops up.

Therefore I
would like to suggest to only popup the image info when
the mouse cursur is over the thumbnail and not when it's
over the surrounding area used for spacing and image infos.
(as default or configurable)

I show comments and size of an image by default below the
thumbnail so the area is much bigger than the thumbnail.
Comment 1 Joern Ahrens 2005-02-11 10:44:29 UTC
Just for information, so this thing isn't implemented twice...
I have implemented it today, but the commit has to wait until 0.7.2 is released, because we're in string freeze now.

So be patient ;-)

I let this wish open until i have committed the code.
Comment 2 Joern Ahrens 2005-02-11 20:27:28 UTC
CVS commit by jahrens: 

We just decided not to make this behavior configurable.
So it's possible to commit before 0.7.2 release.

Hey Achim, no more reason to walk in circles. Stop walking
and update ;-)

BUG: 88805


  M +10 -0     albumiconitem.cpp   1.29
  M +1 -0      albumiconitem.h   1.8
  M +14 -1     albumiconview.cpp   1.109
  M +2 -0      albumiconview.h   1.35
  M +17 -2     thumbview.cpp   1.27
  M +2 -0      thumbview.h   1.12


--- kdeextragear-3/digikam/digikam/albumiconitem.cpp  #1.28:1.29
@@ -327,2 +327,12 @@ void AlbumIconItem::paintItem(QPainter *
 }
 
+QRect AlbumIconItem::thumbnailRect()
+{
+    QRect pixmapRect = view_->itemPixmapRect();
+    QRect r          = rect();
+    
+    return QRect(r.x()+pixmapRect.x() + (pixmapRect.width()-thumbnail_.width())/2,
+                 r.y()+pixmapRect.y() + (pixmapRect.height()-thumbnail_.height())/2,
+                 thumbnail_.width(), thumbnail_.height());
+}
+

--- kdeextragear-3/digikam/digikam/albumiconitem.h  #1.7:1.8
@@ -68,4 +68,5 @@ public:
 
     void setPixmap(const QPixmap& thumb, const KFileMetaInfo* metaInfo);
+    QRect thumbnailRect();
 
     virtual int compare(ThumbItem *item);

--- kdeextragear-3/digikam/digikam/albumiconview.cpp  #1.108:1.109
@@ -1453,4 +1452,18 @@ void AlbumIconView::slotContentsMoving(i
 }
 
+bool AlbumIconView::acceptToolTip(ThumbItem *item, const QPoint &mousePos)
+{
+    AlbumIconItem *iconItem = dynamic_cast<AlbumIconItem*>(item);
+    
+    if(iconItem && iconItem->thumbnailRect().contains(mousePos))
+    {
+        return true;
+    }
+    else
+    {    
+        return false;
+    }
+}
+
 void AlbumIconView::slotShowToolTip(ThumbItem* item)
 {

--- kdeextragear-3/digikam/digikam/albumiconview.h  #1.34:1.35
@@ -122,4 +122,6 @@ protected:
     void contentsDropEvent(QDropEvent *e);
 
+    bool acceptToolTip(ThumbItem *item, const QPoint &mousePos);
+    
 private:
 

--- kdeextragear-3/digikam/digikam/thumbview.cpp  #1.26:1.27
@@ -773,4 +773,8 @@ void ThumbView::contentsMousePressEvent(
 }
 
+bool ThumbView::acceptToolTip(ThumbItem *, const QPoint &)
+{
+    return true;
+}
 
 void ThumbView::contentsMouseMoveEvent(QMouseEvent *e)
@@ -796,6 +800,9 @@ void ThumbView::contentsMouseMoveEvent(Q
             {
                 d->toolTipItem = 0;
+                d->toolTipTimer->stop();
                 slotToolTip();
                 
+                if(acceptToolTip(item, e->pos()))
+                {
                 d->toolTipItem = item;
                 d->toolTipTimer->start(500, true);
@@ -803,4 +810,12 @@ void ThumbView::contentsMouseMoveEvent(Q
         }
                 
+            if(item == d->toolTipItem && !acceptToolTip(item, e->pos()))
+            {
+                d->toolTipItem = 0;
+                d->toolTipTimer->stop();
+                slotToolTip();                
+            }
+        }
+                
         if(KGlobalSettings::changeCursorOverIcon())
         {

--- kdeextragear-3/digikam/digikam/thumbview.h  #1.11:1.12
@@ -100,4 +100,6 @@ protected:
     virtual void contentsDropEvent(QDropEvent *e);
 
+    virtual bool acceptToolTip(ThumbItem *item, const QPoint &mousePos);
+
 private: