mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: install event filter only for the icon widget in launcher applet
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2cf8a5b37a
commit
b6624d8083
1 changed files with 2 additions and 2 deletions
|
@ -348,6 +348,7 @@ void LauncherWidget::setMimeData(QMimeData *mimedata)
|
||||||
if (mimedata) {
|
if (mimedata) {
|
||||||
m_mimedata = mimedata;
|
m_mimedata = mimedata;
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
|
// Plasma::IconWidget is kinda special, event filter is a must for DnD
|
||||||
m_iconwidget->setAcceptedMouseButtons(Qt::LeftButton);
|
m_iconwidget->setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
m_iconwidget->installSceneEventFilter(this);
|
m_iconwidget->installSceneEventFilter(this);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +447,6 @@ void LauncherWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
||||||
const QRectF brect = boundingRect();
|
const QRectF brect = boundingRect();
|
||||||
const QSizeF brectsize = brect.size();
|
const QSizeF brectsize = brect.size();
|
||||||
const qreal oldopacity = painter->opacity();
|
const qreal oldopacity = painter->opacity();
|
||||||
m_framesvg->setElementPrefix("hover");
|
|
||||||
m_framesvg->resizeFrame(brectsize);
|
m_framesvg->resizeFrame(brectsize);
|
||||||
painter->setOpacity(m_hover);
|
painter->setOpacity(m_hover);
|
||||||
m_framesvg->paintFrame(painter, brect);
|
m_framesvg->paintFrame(painter, brect);
|
||||||
|
@ -484,7 +484,7 @@ void LauncherWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
bool LauncherWidget::sceneEventFilter(QGraphicsItem *item, QEvent *event)
|
bool LauncherWidget::sceneEventFilter(QGraphicsItem *item, QEvent *event)
|
||||||
{
|
{
|
||||||
if ((item == m_iconwidget || item == m_textwidget) && event->type() == QEvent::GraphicsSceneMouseMove) {
|
if (item == m_iconwidget && event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||||
QGraphicsSceneMouseEvent* mouseevent = static_cast<QGraphicsSceneMouseEvent*>(event);
|
QGraphicsSceneMouseEvent* mouseevent = static_cast<QGraphicsSceneMouseEvent*>(event);
|
||||||
if (m_mimedata && handleMouseEvent(mouseevent)) {
|
if (m_mimedata && handleMouseEvent(mouseevent)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue