[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kget
From: Pino Toscano <toscano.pino () tiscali ! it>
Date: 2005-07-18 17:09:30
Message-ID: 1121706570.707674.19249.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 435925 by pino:
Another backport from the make_kget_cool branch: make the drop target movement
more fluid.
The drop target now can be slightly slower than the mouse movement when dragged,
but sure it doesn't behave anymore like a crazy ball.
BUG: 95415
M +17 -4 droptarget.cpp
M +6 -2 droptarget.h
--- trunk/KDE/kdenetwork/kget/droptarget.cpp #435924:435925
@@ -102,6 +102,8 @@
popupMenu->insertSeparator();
kmain->m_paQuit->plug(popupMenu);
+ isdragging = false;
+
// Enable dropping
setAcceptDrops(true);
}
@@ -119,9 +121,11 @@
if (e->button() == LeftButton)
{
// toggleMinimizeRestore ();
- oldX = 0;
- oldY = 0;
-
+// oldX = 0;
+// oldY = 0;
+ isdragging = true;
+ dx = QCursor::pos().x() - pos().x();
+ dy = QCursor::pos().y() - pos().y();
}
else if (e->button() == RightButton)
{
@@ -198,16 +202,25 @@
/** No descriptions */
void DropTarget::mouseMoveEvent(QMouseEvent * e)
{
+/*
if (oldX == 0)
{
oldX = e->x();
oldY = e->y();
return;
}
++*/
+ if (isdragging)
+ move( QCursor::pos().x() - dx, QCursor::pos().y() - dy );
- QWidget::move(x() + (e->x() - oldX), y() + (e->y() - oldY));
+// move(x() + (e->x() - oldX), y() + (e->y() - oldY)); // <<--
}
+void DropTarget::mouseReleaseEvent(QMouseEvent *)
+{
+ isdragging = false;
+}
+
/** No descriptions */
void DropTarget::mouseDoubleClickEvent(QMouseEvent * e)
{
--- trunk/KDE/kdenetwork/kget/droptarget.h #435924:435925
@@ -56,6 +56,7 @@
/** No descriptions */
virtual void mouseMoveEvent(QMouseEvent *);
virtual void mousePressEvent(QMouseEvent * e);
+ virtual void mouseReleaseEvent(QMouseEvent *);
private slots:
void toggleSticky();
@@ -76,8 +77,11 @@
QBitmap mask;
public: // Public attributes
/** */
- int oldX;
- int oldY;
+// int oldX;
+// int oldY;
+ int dx;
+ int dy;
+ bool isdragging;
};
#endif // _DROPTARGET_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic