From 22afca58bf14e114f23b44f5b24c6692985bd21c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 15 Oct 2013 23:18:09 -0300 Subject: [PATCH] Fixed the moving around of the InfoPanel on non KDE enviroments. This patch restores the ability to move the info-overlay panel on the profile. For some reason the eventFilter wasn't working (and actually, looking at the code, it really shouldn't, because I didn't see where I set it to work, maybe someone (me) broke it a long time ago) well, it seems fixed now at least. :) Tested on XFCE, Gnome and KDE, with three different window managers. [Dirk Hohndel: removed debug output] Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profilegraphics.cpp | 20 ++------------------ qt-ui/profilegraphics.h | 3 --- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 8f9c8d00c..e5b5cd50a 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -1392,8 +1392,7 @@ ToolTipItem::ToolTipItem(QGraphicsItem* parent): QGraphicsPathItem(parent), back { title = new QGraphicsSimpleTextItem(tr("Information"), this); separator = new QGraphicsLineItem(this); - dragging = false; - setFlag(ItemIgnoresTransformations); + setFlags(ItemIgnoresTransformations | ItemIsMovable); status = COLLAPSED; updateTitlePosition(); setZValue(99); @@ -1440,12 +1439,7 @@ bool ToolTipItem::isExpanded() { void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { persistPos(); - dragging = false; -} - -void ToolTipItem::mousePressEvent(QGraphicsSceneMouseEvent* event) -{ - dragging = true; + QGraphicsPathItem::mouseReleaseEvent(event); } void ToolTipItem::persistPos() @@ -1468,16 +1462,6 @@ void ToolTipItem::readPos() setPos(value); } -bool ToolTipItem::eventFilter(QObject* view, QEvent* event) -{ - if (event->type() == QEvent::HoverMove && dragging){ - QHoverEvent *e = static_cast(event); - QGraphicsView *v = scene()->views().at(0); - setPos( v->mapToScene(e->pos())); - } - return false; -} - QColor EventItem::getColor(const color_indice_t i) { return profile_color[i].at((isGrayscale) ? 1 : 0); diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index a45243ba3..7fe4f9ff7 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -39,9 +39,7 @@ public: bool isExpanded(); void persistPos(); void readPos(); - void mousePressEvent(QGraphicsSceneMouseEvent* event); void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); - bool eventFilter(QObject* , QEvent* ); public slots: void setRect(const QRectF& rect); @@ -53,7 +51,6 @@ private: QGraphicsSimpleTextItem *title; Status status; QRectF rectangle; - bool dragging; QRectF nextRectangle; };