From b7ef8531236dce935aec187997303a3cb4f0e4de Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sat, 17 Nov 2007 21:34:28 +0000 Subject: [PATCH] stub in elementAtPoint; it doesn't actually do anything right now pending changes to QSvgRenderer, but the code is all there ready to go svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=738069 --- svg.cpp | 11 +++++++++++ svg.h | 6 ++++++ 2 files changed, 17 insertions(+) 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.