don't block events on text elements that have Qt::TextSelectableByMouse

svn path=/trunk/KDE/kdelibs/; revision=1189643
This commit is contained in:
Marco Martin 2010-10-25 13:37:31 +00:00
parent 21869b4aa2
commit 37d302047e

View File

@ -33,18 +33,26 @@
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
#include <QLabel>
//KDE
#include <kmimetype.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <ktextedit.h>
#include <ktextbrowser.h>
//Plasma
#include <plasma/widgets/scrollbar.h>
#include <plasma/widgets/svgwidget.h>
#include <plasma/widgets/label.h>
#include <plasma/widgets/textedit.h>
#include <plasma/widgets/textbrowser.h>
#include <plasma/animator.h>
#include <plasma/svg.h>
#define DEBUG 0
/*
@ -1437,6 +1445,23 @@ bool ScrollWidget::sceneEventFilter(QGraphicsItem *i, QEvent *e)
return false;
}
if (i->isWidget()) {
Plasma::Label *label = dynamic_cast<Plasma::Label *>(static_cast<QGraphicsWidget *>(i));
if (label && (label->nativeWidget()->textInteractionFlags() & Qt::TextSelectableByMouse)) {
return false;
}
Plasma::TextEdit *textEdit = dynamic_cast<Plasma::TextEdit *>(static_cast<QGraphicsWidget *>(i));
if (textEdit && (textEdit->nativeWidget()->textInteractionFlags() & Qt::TextSelectableByMouse)) {
return false;
}
Plasma::TextBrowser *textBrowser= dynamic_cast<Plasma::TextBrowser *>(static_cast<QGraphicsWidget *>(i));
if (textBrowser && (textBrowser->nativeWidget()->textInteractionFlags() & Qt::TextSelectableByMouse)) {
return false;
}
}
bool stealThisEvent = d->stealEvent;
//still pass around mouse moves: try to make still possible to make items start a drag event. thi could be either necessary or annoying, let's see how it goes. (add QEvent::GraphicsSceneMouseMove to block them)
stealThisEvent &= (e->type() == QEvent::GraphicsSceneMousePress ||