[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/netbook/containments/sal
From: Marco Martin <notmart () gmail ! com>
Date: 2009-08-24 17:36:53
Message-ID: 1251135413.759012.11304.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1015159 by mart:
this way of doing scrolling by dragging is simpler and most important,
actually works
M +8 -17 sal.cpp
--- trunk/playground/base/plasma/netbook/containments/sal/sal.cpp #1015158:1015159
@@ -49,7 +49,8 @@
m_maxColumnWidth(0),
m_viewMainWidget(0),
m_gridScroll(0),
- m_appletsLayout(0)
+ m_appletsLayout(0),
+ m_buttonDownMousePos(QPoint())
{
setContainmentType(Containment::CustomContainment);
}
@@ -497,22 +498,12 @@
qobject_cast<Plasma::Frame *>(watched)) {
m_hoverIndicator->animatedSetVisible(false);
//pass click only if the user didn't move the mouse
- } else if (event->type() == QEvent::GraphicsSceneMousePress && \
m_buttonDownMousePos == QPoint()) {
- QGraphicsSceneMouseEvent *mp = static_cast<QGraphicsSceneMouseEvent \
*>(event);
- m_buttonDownMousePos = mp->pos();
- event->ignore();
- return true;
- } else if (event->type() == QEvent::GraphicsSceneMouseRelease) {
- QGraphicsSceneMouseEvent *mr = static_cast<QGraphicsSceneMouseEvent \
*>(event);
- if (QPoint(mr->pos().toPoint() - \
m_buttonDownMousePos.toPoint()).manhattanLength() < \
QApplication::startDragDistance()) {
- QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
- me.setPos(mr->pos());
- me.setButton(mr->button());
- me.setButtons(mr->buttons());
- me.setModifiers(mr->modifiers());
- QApplication::sendEvent(watched, &me);
- }
- m_buttonDownMousePos = QPoint();
+ } else if (event->type() == QEvent::GraphicsSceneMouseMove) {
+ QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent \
*>(event); +
+ QPointF deltaPos = me->pos() - me->lastPos();
+ m_viewMainWidget->setPos(m_viewMainWidget->pos().x(),
+ \
qBound(qMin((qreal)0,-m_viewMainWidget->size().height()+m_gridScroll->size().height()), \
m_viewMainWidget->pos().y()+deltaPos.y(), (qreal)0)); }
return false;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic