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

List:       kde-usability
Subject:    branches/KDE/3.5/kdegraphics/ksnapshot
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2006-08-28 18:36:19
Message-ID: 1156790179.818268.32660.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 578236 by aseigo:

make it more obvious that this can be dragged by changing the cursor on
hover to a hand and drawing a drag grippy on the pixmap. weeeeee... now
maybe people will figure it out that you can drag the damn thing ;)
CCMAIL:kde-usability@kde.org


 M  +33 -0     ksnapshot.h  


--- branches/KDE/3.5/kdegraphics/ksnapshot/ksnapshot.h #578235:578236
@@ -4,8 +4,12 @@
 #define KSNAPSHOT_H
 #include "ksnapshotiface.h"
 
+#include <qbitmap.h>
+#include <qcursor.h>
 #include <qlabel.h>
+#include <qpainter.h>
 #include <qpixmap.h>
+#include <qstyle.h>
 #include <qtimer.h>
 
 #include <dcopclient.h>
@@ -25,9 +29,38 @@
             : QLabel(parent, name)
         {
             setAlignment(AlignHCenter | AlignVCenter);
+            setCursor(QCursor(Qt::PointingHandCursor));
         }
         virtual ~KSnapshotPreview() {}
 
+        void setPixmap(const QPixmap& pm)
+        {
+            // if this looks convoluted, that's because it is. drawing a PE_SizeGrip
+            // does unexpected things when painting directly onto the pixmap
+            QPixmap pixmap(pm);
+            QPixmap handle(15, 15);
+            QBitmap mask(15, 15, true);
+
+            {
+                QPainter p(&mask);
+                style().drawPrimitive(QStyle::PE_SizeGrip, &p, QRect(0, 0, 15, 15), palette().active());
+                p.end();
+                handle.setMask(mask);
+            }
+
+            {
+                QPainter p(&handle);
+                style().drawPrimitive(QStyle::PE_SizeGrip, &p, QRect(0, 0, 15, 15), palette().active());
+                p.end();
+            }
+
+            QRect rect(pixmap.width() - 16, pixmap.height() - 16, 15, 15);
+            QPainter p(&pixmap);
+            p.drawPixmap(rect, handle);
+            p.end();
+            QLabel::setPixmap(pixmap);
+        }
+
     signals:
         void startDrag();
 
_______________________________________________
kde-usability mailing list
kde-usability@kde.org
https://mail.kde.org/mailman/listinfo/kde-usability
[prev in list] [next in list] [prev in thread] [next in thread] 

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