make the clicking actually work
BUG:233746 svn path=/trunk/KDE/kdelibs/; revision=1129251
This commit is contained in:
parent
32a40accec
commit
31fda702c4
|
@ -22,6 +22,7 @@
|
|||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QGraphicsSceneMouseEvent>
|
||||
|
||||
#include "kdebug.h"
|
||||
#include "svg.h"
|
||||
|
||||
namespace Plasma
|
||||
|
@ -55,15 +56,22 @@ SvgWidget::~SvgWidget()
|
|||
delete d;
|
||||
}
|
||||
|
||||
void SvgWidget::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||
void SvgWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
// we check for receivers so that SvgWidgets that aren't being used for events remain "click
|
||||
// transparent"
|
||||
if (receivers(SIGNAL(clicked(Qt::MouseButton)))) {
|
||||
emit clicked(event->button());
|
||||
} else {
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void SvgWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (boundingRect().contains(event->pos())) {
|
||||
emit clicked(event->button());
|
||||
}
|
||||
}
|
||||
|
||||
void SvgWidget::setSvg(Svg *svg)
|
||||
{
|
||||
d->svg = svg;
|
||||
|
|
|
@ -49,8 +49,6 @@ class PLASMA_EXPORT SvgWidget : public QGraphicsWidget
|
|||
QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
|
||||
virtual ~SvgWidget();
|
||||
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
|
||||
void setSvg(Svg *svg);
|
||||
Svg *svg() const;
|
||||
|
||||
|
@ -63,6 +61,8 @@ class PLASMA_EXPORT SvgWidget : public QGraphicsWidget
|
|||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent * event);
|
||||
|
||||
private:
|
||||
SvgWidgetPrivate * const d;
|
||||
|
|
Loading…
Reference in New Issue
Block a user