Allow plasmoids to ignore the margins

This commit is contained in:
Niccolò Venerandi 2020-08-04 16:46:00 +02:00
parent e510d9d3ce
commit e5a6deb8ba
3 changed files with 20 additions and 0 deletions

View File

@ -177,6 +177,7 @@ private:
Q_PRIVATE_SLOT(d, void maximumHeightChanged())
Q_PRIVATE_SLOT(d, void fillWidthChanged())
Q_PRIVATE_SLOT(d, void fillHeightChanged())
};
}

View File

@ -618,6 +618,16 @@ bool AppletInterface::hideOnWindowDeactivate() const
return m_hideOnDeactivate;
}
void AppletInterface::setApplyMarginsProperty(bool margins)
{
m_apply_margins = margins;
}
bool AppletInterface::applyMargins() const
{
return m_apply_margins;
}
QKeySequence AppletInterface::globalShortcut() const
{
return applet()->globalShortcut();

View File

@ -250,6 +250,11 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
Q_PROPERTY(bool loading MEMBER m_loading NOTIFY isLoadingChanged)
/**
* When false the plasmoid will ignore the margins when contained in a panel
*/
Q_PROPERTY(bool applyMargins READ applyMargins WRITE setApplyMarginsProperty NOTIFY applyMarginsChanged)
public:
AppletInterface(DeclarativeAppletScript *script, const QVariantList &args = QVariantList(), QQuickItem *parent = nullptr);
~AppletInterface() override;
@ -415,6 +420,8 @@ public:
QString configurationRequiredReason() const;
void setConfigurationRequiredReason(const QString &reason);
bool applyMargins() const;
void setApplyMarginsProperty(bool applyMargins);
Q_SIGNALS:
/**
@ -461,6 +468,7 @@ Q_SIGNALS:
void associatedApplicationUrlsChanged();
void availableScreenRegionChanged();
void availableScreenRectChanged();
void applyMarginsChanged();
void userConfiguringChanged();
void globalShortcutChanged();
@ -511,6 +519,7 @@ private:
friend class ContainmentInterface;
//This is used by ContainmentInterface
QPointF m_positionBeforeRemoval;
bool m_apply_margins = true;
};
QML_DECLARE_TYPEINFO(AppletInterface, QML_HAS_ATTACHED_PROPERTIES)