First steps towards scriptability

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=690375
This commit is contained in:
Richard J. Moore 2007-07-20 21:00:11 +00:00
parent 51a0162fae
commit 23c1f996d2
2 changed files with 16 additions and 5 deletions

View File

@ -43,6 +43,14 @@ class Package;
class PLASMA_EXPORT Applet : public QObject, public Widget class PLASMA_EXPORT Applet : public QObject, public Widget
{ {
Q_OBJECT Q_OBJECT
// Q_PROPERTY( QRectF maxSizeHint READ maxSizeHint ) // Not sure why this fails
Q_PROPERTY( bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface )
Q_PROPERTY( QString name READ name )
Q_PROPERTY( QString category READ category )
Q_PROPERTY( bool immutable READ immutable WRITE setImmutable )
Q_PROPERTY( bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground )
Q_PROPERTY( bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch )
Q_PROPERTY( QRectF boundingRect READ boundingRect )
public: public:
typedef QList<Applet*> List; typedef QList<Applet*> List;

13
svg.h
View File

@ -45,6 +45,9 @@ namespace Plasma
class PLASMA_EXPORT Svg : public QObject class PLASMA_EXPORT Svg : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS( ContentType )
Q_PROPERTY( QSize size READ size )
Q_PROPERTY( ContentType contentType READ contentType WRITE setContentType )
public: public:
/** /**
@ -117,34 +120,34 @@ class PLASMA_EXPORT Svg : public QObject
* @arg width the new width * @arg width the new width
* @arg height the new height * @arg height the new height
**/ **/
void resize( int width, int height ); Q_INVOKABLE void resize( int width, int height );
/** /**
* Resizes the rendered image. Rendering will actually take place on * Resizes the rendered image. Rendering will actually take place on
* the next call to paint. * the next call to paint.
* @arg size the new size of the image * @arg size the new size of the image
**/ **/
void resize( const QSizeF& size ); Q_INVOKABLE void resize( const QSizeF& size );
/** /**
* Resizes the rendered image to the natural size of the SVG. * Resizes the rendered image to the natural size of the SVG.
* Rendering will actually take place on the next call to paint. * Rendering will actually take place on the next call to paint.
**/ **/
void resize(); Q_INVOKABLE void resize();
/** /**
* Size of a given element * Size of a given element
* @arg elementId the id of the element to check * @arg elementId the id of the element to check
* @return the current size of a given element * @return the current size of a given element
**/ **/
QSize elementSize( const QString& elementId ) const; Q_INVOKABLE QSize elementSize( const QString& elementId ) const;
/** /**
* Check when an element exists in the loaded Svg * Check when an element exists in the loaded Svg
* @arg elementId the id of the element to check * @arg elementId the id of the element to check
* @return true if the element is defined in the Svg, otherwise false * @return true if the element is defined in the Svg, otherwise false
**/ **/
bool elementExists( const QString& elementId ) const; Q_INVOKABLE bool elementExists( const QString& elementId ) const;
/** /**
* Currently set size of the SVG * Currently set size of the SVG