[plasma/libplasma] src/declarativeimports/core: fix documentation for PlasmaCore.Action
Nate Graham <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 1a24ec6bf7ea9b24d6f8514a483a6796740ae41d by Nate Graham, on behalf of Bharadwaj Raju.
Committed on 23/07/2026 at 19:18.
Pushed by ngraham into branch 'master'.
fix documentation for PlasmaCore.Action
The previous description `This class is exposed to wallpapers as the WallpaperItem root qml item.` seems to be an artifact from the `wallpaperitem.h` file :P
This MR changes that to an actually relevant description, adds an example snippet, and documents all the properties (mostly just telling the reader to see-also the relevant thing in QAction, but still).
M +31 -1 src/declarativeimports/core/action.h
https://invent.kde.org/plasma/libplasma/-/commit/1a24ec6bf7ea9b24d6f8514a483a6796740ae41d
diff --git a/src/declarativeimports/core/action.h b/src/declarativeimports/core/action.h
index fd683165b..7a7fde101 100644
--- a/src/declarativeimports/core/action.h
+++ b/src/declarativeimports/core/action.h
@@ -49,7 +49,24 @@ private:
* \inqmlmodule org.kde.plasma.core
* \inherits QtObject
*
- * \brief This class is exposed to wallpapers as the WallpaperItem root qml item.
+ * \brief Represents an action on a Plasmoid.
+ *
+ * Unlike Qt Quick Controls' Action type, this is backed by a \l QAction.
+ *
+ * Use this to define actions for a Plasmoid, such as \l {Plasma::Applet::contextualActions} {\c {Plasmoid.contextualActions}}
+ * or \l {Plasma::Applet::setInternalAction} {\c {Plasmoid.setInternalAction}}
+ *
+ * Example usage:
+ *
+ * \qml
+ * import org.kde.plasma.core as PlasmaCore
+ *
+ * PlasmaCore.Action {
+ * text: "Run"
+ * icon.name: "system-run-symbolic"
+ * onTriggered: runProcess()
+ * }
+ * \endqml
*/
class ActionExtension : public QObject
{
@@ -58,26 +75,39 @@ class ActionExtension : public QObject
/*!
* \qmlproperty string Action::icon.name
* \qmlproperty QIcon Action::icon.icon
+ *
+ * The icon for this action. Can be a system icon name (through \c{icon.name}) or a \l {QIcon} (through \c{icon.icon}).
*/
Q_PROPERTY(IconGroup *icon MEMBER m_iconGroup CONSTANT)
/*!
* \qmlproperty bool Action::isSeparator
+ *
+ * Defaults to false.
+ *
+ * \sa QAction::isSeparator
*/
Q_PROPERTY(bool isSeparator READ isSeparator WRITE setSeparator NOTIFY isSeparatorChanged)
/*!
* \qmlproperty QActionGroup Action::actionGroup
+ *
+ * \sa QAction::actionGroup
*/
Q_PROPERTY(QActionGroup *actionGroup READ actionGroup WRITE setActionGroup NOTIFY actionGroupChanged)
/*!
* \qmlproperty variant Action::shortcut
+ *
+ * The shortcut that can be used to activate this action.
+ * Can be a string describing a sequence (like \c {"Ctrl+Shift+X"}) or a \l {QKeySequence::StandardKey}.
*/
Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged)
/*!
* \qmlproperty QMenu Action::menu
+ *
+ * \sa QAction::setMenu
*/
Q_PROPERTY(QMenu *menu READ menu WRITE setMenu NOTIFY menuChanged)