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:
parent
78bfa23fac
commit
ade65ba938
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user