diff --git a/src/plasma/plasma.h b/src/plasma/plasma.h index 7c4ad7972..533e11399 100644 --- a/src/plasma/plasma.h +++ b/src/plasma/plasma.h @@ -62,7 +62,17 @@ public: ImmutableConstraint }; Q_ENUM(Constraint) + Q_DECLARE_FLAGS(Constraints, Constraint) + /** + * This enumeration lists the various hints that an applet can pass to its + * constraint regarding the way that it is represented + */ + enum ConstraintHints { + NoHint = 0, + CanFillArea = 1 /**< The applet can fill the area and ignore constraint margins*/ + }; + Q_ENUM(ConstraintHints) /** * The FormFactor enumeration describes how a Plasma::Applet should arrange diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index d54b475fa..2be4a9fe8 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -618,14 +618,14 @@ bool AppletInterface::hideOnWindowDeactivate() const return m_hideOnDeactivate; } -void AppletInterface::setApplyMarginsProperty(bool margins) +void AppletInterface::setConstraintHints(Plasma::Types::ConstraintHints hints) { - m_apply_margins = margins; + m_constraintHints = hints; } -bool AppletInterface::applyMargins() const +Plasma::Types::ConstraintHints AppletInterface::constraintHints() const { - return m_apply_margins; + return m_constraintHints; } QKeySequence AppletInterface::globalShortcut() const diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index eaf525d7b..44bf5bf5f 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -253,7 +253,7 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem /** * When false the plasmoid will ignore the margins when contained in a panel */ - Q_PROPERTY(bool applyMargins READ applyMargins WRITE setApplyMarginsProperty NOTIFY applyMarginsChanged) + Q_PROPERTY(Plasma::Types::ConstraintHints constraintHints READ constraintHints WRITE setConstraintHints NOTIFY constraintHintsChanged) public: AppletInterface(DeclarativeAppletScript *script, const QVariantList &args = QVariantList(), QQuickItem *parent = nullptr); @@ -420,8 +420,8 @@ public: QString configurationRequiredReason() const; void setConfigurationRequiredReason(const QString &reason); - bool applyMargins() const; - void setApplyMarginsProperty(bool applyMargins); + Plasma::Types::ConstraintHints constraintHints() const; + void setConstraintHints(Plasma::Types::ConstraintHints constraintHints); Q_SIGNALS: /** @@ -468,7 +468,7 @@ Q_SIGNALS: void associatedApplicationUrlsChanged(); void availableScreenRegionChanged(); void availableScreenRectChanged(); - void applyMarginsChanged(); + void constraintHintsChanged(); void userConfiguringChanged(); void globalShortcutChanged(); @@ -519,7 +519,7 @@ private: friend class ContainmentInterface; //This is used by ContainmentInterface QPointF m_positionBeforeRemoval; - bool m_apply_margins = true; + Plasma::Types::ConstraintHints m_constraintHints = Plasma::Types::ConstraintHints::NoHint; }; QML_DECLARE_TYPEINFO(AppletInterface, QML_HAS_ATTACHED_PROPERTIES)