Added click signal to SvgWidget.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=874074
This commit is contained in:
parent
1dc982c466
commit
9ed5641257
@ -20,6 +20,7 @@
|
||||
#include "svgwidget.h"
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QGraphicsSceneMouseEvent>
|
||||
|
||||
#include "svg.h"
|
||||
|
||||
@ -54,6 +55,15 @@ SvgWidget::~SvgWidget()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void SvgWidget::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||
{
|
||||
if (receivers(SIGNAL(clicked(Qt::MouseButton)))){
|
||||
emit clicked(event->button());
|
||||
}else{
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void SvgWidget::setSvg(Svg *svg)
|
||||
{
|
||||
d->svg = svg;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef PLASMA_GRAPHICSSVGITEM_H
|
||||
#define PLASMA_GRAPHICSSVGITEM_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QGraphicsWidget>
|
||||
|
||||
#include <plasma/plasma_export.h>
|
||||
@ -37,18 +36,26 @@ class PLASMA_EXPORT SvgWidget : public QGraphicsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(Svg *svg READ svg WRITE setSvg)
|
||||
Q_PROPERTY(QString elementID READ elementID WRITE setElementID)
|
||||
|
||||
public:
|
||||
SvgWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
|
||||
SvgWidget(Svg *svg, const QString & elementID = QString(),
|
||||
QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
|
||||
virtual ~SvgWidget();
|
||||
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
|
||||
void setSvg(Svg *svg);
|
||||
Svg *svg() const;
|
||||
|
||||
void setElementID(const QString &elementID);
|
||||
QString elementID() const;
|
||||
|
||||
signals:
|
||||
void clicked(Qt::MouseButton);
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user