check if the applet pointer has been resetted to 0 by switchContainment

BUG: 165850

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=828716
This commit is contained in:
Marco Martin 2008-07-06 13:01:02 +00:00
parent 6425a5a4d9
commit 02203edad2

View File

@ -156,8 +156,13 @@ QRectF Plasma::AppletHandle::boundingRect() const
QPainterPath AppletHandle::shape() const QPainterPath AppletHandle::shape() const
{ {
QPainterPath path = PaintUtils::roundedRectangle(m_rect, 10); //when the containment changes the applet is resetted to 0
return path.united(m_applet->mapToParent(m_applet->shape())); if (m_applet) {
QPainterPath path = PaintUtils::roundedRectangle(m_rect, 10);
return path.united(m_applet->mapToParent(m_applet->shape()));
} else {
return QGraphicsItem::shape();
}
} }
void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
@ -267,6 +272,12 @@ AppletHandle::ButtonType AppletHandle::mapToButton(const QPointF &point) const
void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event) void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
//containment recently switched?
if (!m_applet) {
QGraphicsItem::mousePressEvent(event);
return;
}
if (m_pendingFade) { if (m_pendingFade) {
//m_pendingFade = false; //m_pendingFade = false;
return; return;