mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
quicksetting: add api docs
Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
parent
569d268c49
commit
cee1982877
1 changed files with 92 additions and 1 deletions
|
|
@ -15,38 +15,129 @@ class QuickSetting : public QObject
|
|||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
/**
|
||||
* @property QString text
|
||||
* @brief The main text of a quicksetting item.
|
||||
*
|
||||
* The (upper) text / title of a quicksetting item.
|
||||
*
|
||||
* - Getter: text()
|
||||
* - Setter: setText(const QString &)
|
||||
*/
|
||||
Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged)
|
||||
Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) // if no status is explicitly set, On/Off is used by default
|
||||
|
||||
/**
|
||||
* @property QString status
|
||||
* @brief The status (lower) text of a quicksetting item.
|
||||
*
|
||||
* The lower / status text of a quicksetting item. This string
|
||||
* often changes depending on state, e.g. the enabled property.
|
||||
*
|
||||
* If no status is explicitly set, On/Off is used by default.
|
||||
*
|
||||
* - Getter: status()
|
||||
* - Setter: setStatus(const QString &)
|
||||
*/
|
||||
Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
|
||||
/**
|
||||
* @property QString icon
|
||||
* @brief The icon name of the quicksetting item.
|
||||
*
|
||||
* - Getter: iconName()
|
||||
* - Setter: setIconName(const QString &)
|
||||
*/
|
||||
Q_PROPERTY(QString icon READ iconName WRITE setIconName REQUIRED NOTIFY iconNameChanged)
|
||||
|
||||
/**
|
||||
* @property QString settingsCommand
|
||||
* @brief A command that opens the settings app when tapped.
|
||||
*
|
||||
* - Getter: settingsCommand()
|
||||
* - Setter: setSettingsCommand(const QString &)
|
||||
*/
|
||||
Q_PROPERTY(QString settingsCommand READ settingsCommand WRITE setSettingsCommand NOTIFY settingsCommandChanged)
|
||||
|
||||
/**
|
||||
* @property bool enabled
|
||||
* @brief Enables or disables a quicksetting.
|
||||
*
|
||||
* This property indicates whether this item is active, a setting that
|
||||
* is enabled usually carries a highlight item.
|
||||
*
|
||||
* This property defaults to true.
|
||||
*
|
||||
* - Getter: enabled()
|
||||
* - Setter: setEnabled(bool)
|
||||
*/
|
||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
||||
|
||||
/**
|
||||
* @property bool available
|
||||
* @brief Show or remove a quicksetting in the drawer.
|
||||
*
|
||||
* The available property indicates whether this item is currently
|
||||
* listed in the quicksettings drawer view. Items that are not available (this property
|
||||
* is false) are removed temporarily from the list (but not deleted, i.e. they will
|
||||
* still execute signal handlers so they can add themselves back by setting this
|
||||
* property to true.
|
||||
*
|
||||
* This property defaults to true.
|
||||
*
|
||||
* - Getter: available()
|
||||
* - Setter: setAvailable(bool)
|
||||
*/
|
||||
Q_PROPERTY(bool available READ isAvailable WRITE setAvailable NOTIFY availableChanged)
|
||||
|
||||
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
|
||||
Q_CLASSINFO("DefaultProperty", "children")
|
||||
|
||||
public:
|
||||
QuickSetting(QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* \brief Returns the (upper) text / title of a quicksetting item.
|
||||
*/
|
||||
QString text() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the lower / status text of a quicksetting item.
|
||||
*/
|
||||
QString status() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the icon name of the quicksetting item.
|
||||
*/
|
||||
QString iconName() const
|
||||
{
|
||||
return m_iconName;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns a command that opens the settings app when tapped.
|
||||
*/
|
||||
QString settingsCommand() const
|
||||
{
|
||||
return m_settingsCommand;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns enabled property.
|
||||
*/
|
||||
bool isEnabled() const
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns available property.
|
||||
*/
|
||||
bool isAvailable() const
|
||||
{
|
||||
return m_available;
|
||||
|
|
|
|||
Loading…
Reference in a new issue