diff --git a/svg.cpp b/svg.cpp index 3d9c1889c..cfeb88ceb 100644 --- a/svg.cpp +++ b/svg.cpp @@ -273,6 +273,17 @@ bool Svg::elementExists(const QString& elementId) const return d->renderer->elementExists(elementId); } +QString Svg::elementAtPoint(const QPoint &point) const +{ + d->createRenderer(); + QSizeF naturalSize = d->renderer->defaultSize(); + qreal dx = d->size.width() / naturalSize.width(); + qreal dy = d->size.height() / naturalSize.height(); + //kDebug() << point << "is really" << QPoint(point.x() *dx, naturalSize.height() - point.y() * dy); + + return QString(); // d->renderer->elementAtPoint(QPoint(point.x() *dx, naturalSize.height() - point.y() * dy)); +} + QMatrix Svg::matrixForElement(const QString& elementId) const { d->createRenderer(); diff --git a/svg.h b/svg.h index d6f1bcde6..992559190 100644 --- a/svg.h +++ b/svg.h @@ -158,6 +158,12 @@ class PLASMA_EXPORT Svg : public QObject **/ Q_INVOKABLE bool elementExists( const QString& elementId ) const; + /** + * Returns the element (by id) at the given point. An empty string is + * returned if no element is at that point. + */ + Q_INVOKABLE QString elementAtPoint(const QPoint &point) const; + /** * The transformation matrix of the element. That includes the * transformation on the element itself.