diff --git a/scriptengines/javascript/plasmoid/appletinterface.cpp b/scriptengines/javascript/plasmoid/appletinterface.cpp index b09b52224..94819e9aa 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.cpp +++ b/scriptengines/javascript/plasmoid/appletinterface.cpp @@ -414,6 +414,31 @@ AppletInterface::ItemStatus AppletInterface::status() const return (AppletInterface::ItemStatus)((int)(applet()->status())); } +void AppletInterface::setHorizontalSizePolicy(QtSizePolicy horizPolicy) +{ + QSizePolicy policy = applet()->sizePolicy(); + policy.setHorizontalPolicy((QSizePolicy::Policy)horizPolicy); + applet()->setSizePolicy(policy); +} + +AppletInterface::QtSizePolicy AppletInterface::horizontalSizePolicy() const +{ + return (AppletInterface::QtSizePolicy)applet()->sizePolicy().horizontalPolicy(); +} + + +void AppletInterface::setVerticalSizePolicy(QtSizePolicy vertPolicy) +{ + QSizePolicy policy = applet()->sizePolicy(); + policy.setVerticalPolicy((QSizePolicy::Policy)vertPolicy); + applet()->setSizePolicy(policy); +} + +AppletInterface::QtSizePolicy AppletInterface::verticalSizePolicy() const +{ + return (AppletInterface::QtSizePolicy)applet()->sizePolicy().verticalPolicy(); +} + /* QString AppletInterface::downloadPath(const QString &file) { diff --git a/scriptengines/javascript/plasmoid/appletinterface.h b/scriptengines/javascript/plasmoid/appletinterface.h index f782b3549..24f6eb16a 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.h +++ b/scriptengines/javascript/plasmoid/appletinterface.h @@ -80,6 +80,8 @@ class AppletInterface : public QObject Q_PROPERTY(QRectF rect READ rect) Q_PROPERTY(QSizeF size READ size) Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication) + Q_PROPERTY(QtSizePolicy horizontalSizePolicy READ horizontalSizePolicy WRITE setHorizontalSizePolicy) + Q_PROPERTY(QtSizePolicy verticalSizePolicy READ verticalSizePolicy WRITE setVerticalSizePolicy) public: AppletInterface(AbstractJsAppletScript *parent); @@ -304,6 +306,12 @@ enum IntervalAlignment { void setStatus(const ItemStatus &status); ItemStatus status() const; + void setHorizontalSizePolicy(QtSizePolicy policy); + QtSizePolicy horizontalSizePolicy() const; + + void setVerticalSizePolicy(QtSizePolicy policy); + QtSizePolicy verticalSizePolicy() const; + // Q_INVOKABLE QString downloadPath(const QString &file); Q_INVOKABLE QStringList downloadedFiles() const;