some fixes to the toolbox:

* the hoverEvent of the PanelToolbox is always accepted
* the hoverEvent of desktopToolbox is always accepted if the desktop is
  zoomed-out
* boundingRect size of PanelToolbox is halved since it does not zoom
  anymore on mouse over

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=802195
This commit is contained in:
Marco Martin 2008-04-28 19:41:43 +00:00
parent 78bfa23fac
commit ade65ba938
2 changed files with 15 additions and 22 deletions

View File

@ -23,6 +23,7 @@
#include <QGraphicsSceneHoverEvent>
#include <QPainter>
#include <QRadialGradient>
#include <QGraphicsView>
#include <plasma/theme.h>
#include <KColorScheme>
@ -173,15 +174,19 @@ void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
return;
}
QPainterPath path;
int toolSize = size() + (int)d->animFrame - 15;
path.moveTo(size()*2, 0);
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 180, 90);
path.lineTo(size()*2, 0);
Plasma::Applet *applet = qgraphicsitem_cast<Plasma::Applet *>(parentItem());
if (path.contains(event->pos())) {
QGraphicsItem::hoverEnterEvent(event);
return;
if (applet && applet->view() && !applet->view()->transform().isScaling()) {
QPainterPath path;
int toolSize = size() + (int)d->animFrame - 15;
path.moveTo(size()*2, 0);
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 180, 90);
path.lineTo(size()*2, 0);
if (path.contains(event->pos())) {
QGraphicsItem::hoverEnterEvent(event);
return;
}
}
showToolbox();

View File

@ -107,10 +107,10 @@ PanelToolbox::PanelToolbox(QGraphicsItem *parent)
QRectF PanelToolbox::boundingRect() const
{
if (orientation() == Qt::Vertical) {
return QRectF(0, 0, size()*4, -size()*2);
return QRectF(0, 0, size()*2, -size());
//horizontal
} else {
return QRectF(0, 0, -size()*2, size()*4);
return QRectF(0, 0, -size(), size()*2);
}
}
@ -197,18 +197,6 @@ void PanelToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
return;
}
QPainterPath path;
int toolSize = size() + (int)d->animFrame - 15;
path.moveTo(size()*2, 0);
//path.arcTo(QRectF(size() * 2 - toolSize, -toolSize, toolSize*2, toolSize*2), 180, 90);
path.addRect(QRectF(0, 0, toolSize*2, toolSize*2));
path.lineTo(size()*2, 0);
if (path.contains(event->pos())) {
QGraphicsItem::hoverEnterEvent(event);
return;
}
showToolbox();
QGraphicsItem::hoverEnterEvent(event);
}