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

List:       kde-commits
Subject:    extragear/graphics/digikam/digikam
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2009-12-25 11:52:14
Message-ID: 1261741934.224720.9449.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1066014 by mwiesweg:

When starting a drag, give Qt::IgnoreAction as default proposed action.
This is how dolphin starts a drag as well.
When dragging only one image, use it's icon as drag pixmap.

CCBUG: 219908

 M  +1 -1      imagecategorizedview.cpp  
 M  +19 -1     imagedelegate.cpp  


--- trunk/extragear/graphics/digikam/digikam/imagecategorizedview.cpp \
#1066013:1066014 @@ -1034,7 +1034,7 @@
         QDrag *drag = new QDrag(this);
         drag->setPixmap(pixmap);
         drag->setMimeData(data);
-        drag->exec(supportedActions);
+        drag->exec(supportedActions, Qt::IgnoreAction);
     }
 }
 
--- trunk/extragear/graphics/digikam/digikam/imagedelegate.cpp #1066013:1066014
@@ -390,7 +390,25 @@
 
 QPixmap ImageDelegate::pixmapForDrag(const QStyleOptionViewItem& option, const \
QList<QModelIndex>& indexes) const  {
-    QPixmap icon(DesktopIcon("image-jp2", 48));
+    QPixmap icon;
+
+    if (indexes.count() == 1)
+    {
+        QVariant thumbData = indexes.first().data(ImageModel::ThumbnailRole);
+        if (!thumbData.isNull())
+        {
+            icon = thumbData.value<QPixmap>();
+            if (qMax(icon.width(), icon.height()) > KIconLoader::SizeMedium)
+                icon = icon.scaled(KIconLoader::SizeMedium, KIconLoader::SizeMedium,
+                                   Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        }
+    }
+
+    if (icon.isNull())
+    {
+        QPixmap icon(DesktopIcon("image-jp2", KIconLoader::SizeMedium));
+    }
+
     int w = icon.width();
     int h = icon.height();
 


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

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