Hello, Here is a patch that remove the focus stuff in the mousePressEvent of Applet class and remove the overload. Why? Because Qt have a focus policy that manage that for you. It break the binary compatibilty but it not too late no? :D. I think it will avoid some future problems regarding focus.
Review please?
Index: applet.cpp =================================================================== --- applet.cpp (revision 888800) +++ applet.cpp (working copy) @@ -1301,12 +1301,6 @@ } } -void Applet::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - setFocus(Qt::MouseFocusReason); - QGraphicsWidget::mousePressEvent(event); -} - void Applet::focusInEvent(QFocusEvent *event) { if (!isContainment() && containment()) { @@ -1842,6 +1836,7 @@ q->setCacheMode(Applet::DeviceCoordinateCache); q->setAcceptsHoverEvents(true); q->setFlag(QGraphicsItem::ItemIsFocusable, true); + q->setFocusPolicy(Qt::ClickFocus); // FIXME: adding here because nothing seems to be doing it in QGraphicsView, // but it doesn't actually work anyways =/ q->setLayoutDirection(qApp->layoutDirection()); Index: applet.h =================================================================== --- applet.h (revision 888800) +++ applet.h (working copy) @@ -781,11 +781,6 @@ void mouseMoveEvent(QGraphicsSceneMouseEvent *event); /** - * @internal manage the mouse movement to drag the applet around - */ - void mousePressEvent(QGraphicsSceneMouseEvent *event); - - /** * Reimplemented from QGraphicsItem */ void focusInEvent(QFocusEvent *event);
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel