add binding for horizontal and vertical size policy of the plasmoid

This commit is contained in:
Marco Martin 2012-08-01 20:38:35 +02:00
parent f3e607c2cf
commit 8d4c76ac1f
2 changed files with 33 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;