* debug output when an absolute path is provided and the file doesn't exist
* provide an isValid() method svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=691142
This commit is contained in:
parent
0491b8b112
commit
201afe2033
10
svg.cpp
10
svg.cpp
@ -66,6 +66,10 @@ class Svg::Private
|
||||
if (QDir::isAbsolutePath(imagePath)) {
|
||||
path = imagePath;
|
||||
themed = false;
|
||||
|
||||
if (!QFile::exists(path)) {
|
||||
kDebug() << "Plasma::Svg: file '" << path << "' does not exist!" << endl;
|
||||
}
|
||||
} else {
|
||||
themePath = imagePath;
|
||||
themed = true;
|
||||
@ -240,6 +244,12 @@ bool Svg::elementExists(const QString& elementId) const
|
||||
return d->renderer->elementExists(elementId);
|
||||
}
|
||||
|
||||
bool Svg::isValid() const
|
||||
{
|
||||
d->createRenderer();
|
||||
return d->renderer->isValid();
|
||||
}
|
||||
|
||||
QSize Svg::size() const
|
||||
{
|
||||
return d->size.toSize();
|
||||
|
7
svg.h
7
svg.h
@ -149,6 +149,13 @@ class PLASMA_EXPORT Svg : public QObject
|
||||
**/
|
||||
Q_INVOKABLE bool elementExists( const QString& elementId ) const;
|
||||
|
||||
/**
|
||||
* @return true if the SVG file exists and the document is valid,
|
||||
* otherwise false. This method can be expensive as it
|
||||
* causes disk access.
|
||||
**/
|
||||
Q_INVOKABLE bool isValid() const;
|
||||
|
||||
/**
|
||||
* Currently set size of the SVG
|
||||
* @return the current size of a given element
|
||||
|
Loading…
Reference in New Issue
Block a user