all: use fully qualified type names in Q_PROPERTY

Fixes type deduction issues with qmllint/qmlls.
This commit is contained in:
outfoxxed 2024-11-01 01:43:22 -07:00
parent a931adf033
commit 746b0e70d7
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
14 changed files with 52 additions and 40 deletions

View file

@ -30,7 +30,7 @@ public:
};
Q_ENUM(Enum);
Q_INVOKABLE static QString toString(QsMenuButtonType::Enum value);
Q_INVOKABLE static QString toString(qs::menu::QsMenuButtonType::Enum value);
};
class QsMenuEntry;
@ -79,7 +79,7 @@ class QsMenuEntry: public QsMenuHandle {
/// ```
Q_PROPERTY(QString icon READ icon NOTIFY iconChanged);
/// If this menu item has an associated checkbox or radiobutton.
Q_PROPERTY(QsMenuButtonType::Enum buttonType READ buttonType NOTIFY buttonTypeChanged);
Q_PROPERTY(qs::menu::QsMenuButtonType::Enum buttonType READ buttonType NOTIFY buttonTypeChanged);
/// The check state of the checkbox or radiobutton if applicable, as a
/// [Qt.CheckState](https://doc.qt.io/qt-6/qt.html#CheckState-enum).
Q_PROPERTY(Qt::CheckState checkState READ checkState NOTIFY checkStateChanged);
@ -138,7 +138,7 @@ private:
class QsMenuOpener: public QObject {
Q_OBJECT;
/// The menu to retrieve children from.
Q_PROPERTY(QsMenuHandle* menu READ menu WRITE setMenu NOTIFY menuChanged);
Q_PROPERTY(qs::menu::QsMenuHandle* menu READ menu WRITE setMenu NOTIFY menuChanged);
/// The children of the given menu.
Q_PROPERTY(QQmlListProperty<QsMenuEntry> children READ children NOTIFY childrenChanged);
QML_ELEMENT;

View file

@ -36,7 +36,7 @@ class QsMenuAnchor: public QObject {
/// The menu that should be displayed on this anchor.
///
/// See also: @@Quickshell.Services.SystemTray.SystemTrayItem.menu.
Q_PROPERTY(QsMenuHandle* menu READ menu WRITE setMenu NOTIFY menuChanged);
Q_PROPERTY(qs::menu::QsMenuHandle* menu READ menu WRITE setMenu NOTIFY menuChanged);
/// If the menu is currently open and visible.
///
/// See also: @@open(), @@close().

View file

@ -36,7 +36,7 @@ class DBusMenuPngImage;
class DBusMenuItem: public QsMenuEntry {
Q_OBJECT;
/// Handle to the root of this menu.
Q_PROPERTY(DBusMenu* menuHandle READ menuHandle CONSTANT);
Q_PROPERTY(qs::dbus::dbusmenu::DBusMenu* menuHandle READ menuHandle CONSTANT);
QML_ELEMENT;
QML_UNCREATABLE("DBusMenus can only be acquired from a DBusMenuHandle");
@ -108,7 +108,7 @@ QDebug operator<<(QDebug debug, DBusMenuItem* item);
/// Handle to a menu tree provided by a remote process.
class DBusMenu: public QObject {
Q_OBJECT;
Q_PROPERTY(DBusMenuItem* menu READ menu CONSTANT);
Q_PROPERTY(qs::dbus::dbusmenu::DBusMenuItem* menu READ menu CONSTANT);
QML_NAMED_ELEMENT(DBusMenuHandle);
QML_UNCREATABLE("Menu handles cannot be directly created");

View file

@ -150,11 +150,11 @@ class MprisPlayer: public QObject {
/// - If @@canPause is false, you cannot assign the `Paused` state.
/// - If @@canControl is false, you cannot assign the `Stopped` state.
/// (or any of the others, though their repsective properties will also be false)
Q_PROPERTY(MprisPlaybackState::Enum playbackState READ playbackState WRITE setPlaybackState NOTIFY playbackStateChanged);
Q_PROPERTY(qs::service::mpris::MprisPlaybackState::Enum playbackState READ playbackState WRITE setPlaybackState NOTIFY playbackStateChanged);
/// The loop state of the media player, or `None` if @@loopSupported is false.
///
/// May only be written to if @@canControl and @@loopSupported are true.
Q_PROPERTY(MprisLoopState::Enum loopState READ loopState WRITE setLoopState NOTIFY loopStateChanged);
Q_PROPERTY(qs::service::mpris::MprisLoopState::Enum loopState READ loopState WRITE setLoopState NOTIFY loopStateChanged);
Q_PROPERTY(bool loopSupported READ loopSupported NOTIFY loopSupportedChanged);
/// The speed the song is playing at, as a multiplier.
///

View file

@ -46,7 +46,7 @@ class MprisQml: public QObject {
QML_NAMED_ELEMENT(Mpris);
QML_SINGLETON;
/// All connected MPRIS players.
Q_PROPERTY(ObjectModel<MprisPlayer>* players READ players CONSTANT);
Q_PROPERTY(ObjectModel<qs::service::mpris::MprisPlayer>* players READ players CONSTANT);
public:
explicit MprisQml(QObject* parent = nullptr): QObject(parent) {};

View file

@ -65,6 +65,7 @@ class Notification
: public QObject
, public Retainable {
Q_OBJECT;
// clang-format off
/// Id of the notification as given to the client.
Q_PROPERTY(quint32 id READ id CONSTANT);
/// If the notification is tracked by the notification server.
@ -87,9 +88,9 @@ class Notification
/// The image associated with this notification, or "" if none.
Q_PROPERTY(QString summary READ summary NOTIFY summaryChanged);
Q_PROPERTY(QString body READ body NOTIFY bodyChanged);
Q_PROPERTY(NotificationUrgency::Enum urgency READ urgency NOTIFY urgencyChanged);
Q_PROPERTY(qs::service::notifications::NotificationUrgency::Enum urgency READ urgency NOTIFY urgencyChanged);
/// Actions that can be taken for this notification.
Q_PROPERTY(QVector<NotificationAction*> actions READ actions NOTIFY actionsChanged);
Q_PROPERTY(QVector<qs::service::notifications::NotificationAction*> actions READ actions NOTIFY actionsChanged);
/// If actions associated with this notification have icons available.
///
/// See @@NotificationAction.identifier for details.
@ -107,6 +108,7 @@ class Notification
/// All hints sent by the client application as a javascript object.
/// Many common hints are exposed via other properties.
Q_PROPERTY(QVariantMap hints READ hints NOTIFY hintsChanged);
// clang-format on
QML_ELEMENT;
QML_UNCREATABLE("Notifications must be acquired from a NotificationServer");

View file

@ -67,7 +67,7 @@ class NotificationServerQml
/// If the notification server should advertise that it supports images. Defaults to false.
Q_PROPERTY(bool imageSupported READ imageSupported WRITE setImageSupported NOTIFY imageSupportedChanged);
/// All notifications currently tracked by the server.
Q_PROPERTY(ObjectModel<Notification>* trackedNotifications READ trackedNotifications NOTIFY trackedNotificationsChanged);
Q_PROPERTY(ObjectModel<qs::service::notifications::Notification>* trackedNotifications READ trackedNotifications NOTIFY trackedNotificationsChanged);
/// Extra hints to expose to notification clients.
Q_PROPERTY(QVector<QString> extraHints READ extraHints WRITE setExtraHints NOTIFY extraHintsChanged);
// clang-format on

View file

@ -59,7 +59,7 @@ class Pipewire: public QObject {
/// - @@PwNode.isStream - if the node is an application or hardware device.
/// - @@PwNode.isSink - if the node is a sink or source.
/// - @@PwNode.audio - if non null the node is an audio node.
Q_PROPERTY(ObjectModel<PwNodeIface>* nodes READ nodes CONSTANT);
Q_PROPERTY(ObjectModel<qs::service::pipewire::PwNodeIface>* nodes READ nodes CONSTANT);
/// All links present in pipewire.
///
/// Links connect pipewire nodes to each other, and can be used to determine
@ -70,14 +70,14 @@ class Pipewire: public QObject {
///
/// > [!INFO] Multiple links may exist between the same nodes. See @@linkGroups
/// > for a deduplicated list containing only one entry per link between nodes.
Q_PROPERTY(ObjectModel<PwLinkIface>* links READ links CONSTANT);
Q_PROPERTY(ObjectModel<qs::service::pipewire::PwLinkIface>* links READ links CONSTANT);
/// All link groups present in pipewire.
///
/// The same as @@links but deduplicated.
///
/// If you already have a node you want to check for connections to,
/// use @@PwNodeLinkTracker instead of filtering this list.
Q_PROPERTY(ObjectModel<PwLinkGroupIface>* linkGroups READ linkGroups CONSTANT);
Q_PROPERTY(ObjectModel<qs::service::pipewire::PwLinkGroupIface>* linkGroups READ linkGroups CONSTANT);
/// The default audio sink (output) or `null`.
///
/// This is the default sink currently in use by pipewire, and the one applications
@ -87,7 +87,7 @@ class Pipewire: public QObject {
///
/// > [!INFO] When the default sink changes, this property may breifly become null.
/// > This depends on your hardware.
Q_PROPERTY(PwNodeIface* defaultAudioSink READ defaultAudioSink NOTIFY defaultAudioSinkChanged);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* defaultAudioSink READ defaultAudioSink NOTIFY defaultAudioSinkChanged);
/// The default audio source (input) or `null`.
///
/// This is the default source currently in use by pipewire, and the one applications
@ -97,21 +97,21 @@ class Pipewire: public QObject {
///
/// > [!INFO] When the default source changes, this property may breifly become null.
/// > This depends on your hardware.
Q_PROPERTY(PwNodeIface* defaultAudioSource READ defaultAudioSource NOTIFY defaultAudioSourceChanged);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* defaultAudioSource READ defaultAudioSource NOTIFY defaultAudioSourceChanged);
/// The preferred default audio sink (output) or `null`.
///
/// This is a hint to pipewire telling it which sink should be the default when possible.
/// @@defaultAudioSink may differ when it is not possible for pipewire to pick this node.
///
/// See @@defaultAudioSink for the current default sink, regardless of preference.
Q_PROPERTY(PwNodeIface* preferredDefaultAudioSink READ defaultConfiguredAudioSink WRITE setDefaultConfiguredAudioSink NOTIFY defaultConfiguredAudioSinkChanged);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* preferredDefaultAudioSink READ defaultConfiguredAudioSink WRITE setDefaultConfiguredAudioSink NOTIFY defaultConfiguredAudioSinkChanged);
/// The preferred default audio source (input) or `null`.
///
/// This is a hint to pipewire telling it which source should be the default when possible.
/// @@defaultAudioSource may differ when it is not possible for pipewire to pick this node.
///
/// See @@defaultAudioSource for the current default source, regardless of preference.
Q_PROPERTY(PwNodeIface* preferredDefaultAudioSource READ defaultConfiguredAudioSource WRITE setDefaultConfiguredAudioSource NOTIFY defaultConfiguredAudioSourceChanged);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* preferredDefaultAudioSource READ defaultConfiguredAudioSource WRITE setDefaultConfiguredAudioSource NOTIFY defaultConfiguredAudioSourceChanged);
// clang-format on
QML_ELEMENT;
QML_SINGLETON;
@ -158,12 +158,12 @@ class PwNodeLinkTracker: public QObject {
Q_OBJECT;
// clang-format off
/// The node to track connections to.
Q_PROPERTY(PwNodeIface* node READ node WRITE setNode NOTIFY nodeChanged);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* node READ node WRITE setNode NOTIFY nodeChanged);
/// Link groups connected to the given node.
///
/// If the node is a sink, links which target the node will be tracked.
/// If the node is a source, links which source the node will be tracked.
Q_PROPERTY(QQmlListProperty<PwLinkGroupIface> linkGroups READ linkGroups NOTIFY linkGroupsChanged);
Q_PROPERTY(QQmlListProperty<qs::service::pipewire::PwLinkGroupIface> linkGroups READ linkGroups NOTIFY linkGroupsChanged);
// clang-format on
QML_ELEMENT;
@ -201,6 +201,7 @@ private:
/// See @@PwNode.audio.
class PwNodeAudioIface: public QObject {
Q_OBJECT;
// clang-format off
/// If the node is currently muted. Setting this property changes the mute state.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
@ -213,13 +214,14 @@ class PwNodeAudioIface: public QObject {
/// The audio channels present on the node.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
Q_PROPERTY(QVector<PwAudioChannel::Enum> channels READ channels NOTIFY channelsChanged);
Q_PROPERTY(QVector<qs::service::pipewire::PwAudioChannel::Enum> channels READ channels NOTIFY channelsChanged);
/// The volumes of each audio channel individually. Each entry corrosponds to
/// the volume of the channel at the same index in @@channels. @@volumes and @@channels
/// will always be the same length.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
Q_PROPERTY(QVector<float> volumes READ volumes WRITE setVolumes NOTIFY volumesChanged);
// clang-format on
QML_NAMED_ELEMENT(PwNodeAudio);
QML_UNCREATABLE("PwNodeAudio cannot be created directly");
@ -287,7 +289,7 @@ class PwNodeIface: public PwObjectIface {
///
/// The presence or absence of this property can be used to determine if a node
/// manages audio, regardless of if it is bound. If non null, the node is an audio node.
Q_PROPERTY(PwNodeAudioIface* audio READ audio CONSTANT);
Q_PROPERTY(qs::service::pipewire::PwNodeAudioIface* audio READ audio CONSTANT);
QML_NAMED_ELEMENT(PwNode);
QML_UNCREATABLE("PwNodes cannot be created directly");
@ -325,9 +327,9 @@ class PwLinkIface: public PwObjectIface {
/// with `pw-cli i <id>`.
Q_PROPERTY(quint32 id READ id CONSTANT);
/// The node that is *receiving* information. (the sink)
Q_PROPERTY(PwNodeIface* target READ target CONSTANT);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* target READ target CONSTANT);
/// The node that is *sending* information. (the source)
Q_PROPERTY(PwNodeIface* source READ source CONSTANT);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* source READ source CONSTANT);
/// The current state of the link.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
@ -360,13 +362,13 @@ class PwLinkGroupIface
, public PwObjectRefIface {
Q_OBJECT;
/// The node that is *receiving* information. (the sink)
Q_PROPERTY(PwNodeIface* target READ target CONSTANT);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* target READ target CONSTANT);
/// The node that is *sending* information. (the source)
Q_PROPERTY(PwNodeIface* source READ source CONSTANT);
Q_PROPERTY(qs::service::pipewire::PwNodeIface* source READ source CONSTANT);
/// The current state of the link group.
///
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
Q_PROPERTY(PwLinkState::Enum state READ state NOTIFY stateChanged);
Q_PROPERTY(qs::service::pipewire::PwLinkState::Enum state READ state NOTIFY stateChanged);
QML_NAMED_ELEMENT(PwLinkGroup);
QML_UNCREATABLE("PwLinkGroups cannot be created directly");

View file

@ -72,7 +72,7 @@ class SystemTrayItem: public QObject {
/// A handle to the menu associated with this tray item, if any.
///
/// Can be displayed with @@Quickshell.QsMenuAnchor or @@Quickshell.QsMenuOpener.
Q_PROPERTY(QsMenuHandle* menu READ menu NOTIFY hasMenuChanged);
Q_PROPERTY(qs::menu::QsMenuHandle* menu READ menu NOTIFY hasMenuChanged);
/// If this tray item only offers a menu and activation will do nothing.
Q_PROPERTY(bool onlyMenu READ onlyMenu NOTIFY onlyMenuChanged);
QML_ELEMENT;

View file

@ -53,15 +53,17 @@ class UPowerQml: public QObject {
Q_OBJECT;
QML_NAMED_ELEMENT(UPower);
QML_SINGLETON;
// clang-format off
/// UPower's DisplayDevice for your system. Can be `null`.
///
/// This is an aggregate device and not a physical one, meaning you will not find it in @@devices.
/// It is typically the device that is used for displaying information in desktop environments.
Q_PROPERTY(UPowerDevice* displayDevice READ displayDevice NOTIFY displayDeviceChanged);
Q_PROPERTY(qs::service::upower::UPowerDevice* displayDevice READ displayDevice NOTIFY displayDeviceChanged);
/// All connected UPower devices.
Q_PROPERTY(ObjectModel<UPowerDevice>* devices READ devices CONSTANT);
Q_PROPERTY(ObjectModel<qs::service::upower::UPowerDevice>* devices READ devices CONSTANT);
/// If the system is currently running on battery power, or discharging.
Q_PROPERTY(bool onBattery READ onBattery NOTIFY onBatteryChanged);
// clang-format on
public:
explicit UPowerQml(QObject* parent = nullptr);

View file

@ -85,7 +85,7 @@ class UPowerDevice: public QObject {
Q_OBJECT;
// clang-format off
/// The type of device.
Q_PROPERTY(UPowerDeviceType::Enum type READ type NOTIFY typeChanged);
Q_PROPERTY(qs::service::upower::UPowerDeviceType::Enum type READ type NOTIFY typeChanged);
/// If the device is a power supply for your computer and can provide charge.
Q_PROPERTY(bool powerSupply READ powerSupply NOTIFY powerSupplyChanged);
/// Current energy level of the device in watt-hours.
@ -111,7 +111,7 @@ class UPowerDevice: public QObject {
/// If the device `type` is not `Battery`, then the property will be invalid.
Q_PROPERTY(bool isPresent READ isPresent NOTIFY isPresentChanged);
/// Current state of the device.
Q_PROPERTY(UPowerDeviceState::Enum state READ state NOTIFY stateChanged);
Q_PROPERTY(qs::service::upower::UPowerDeviceState::Enum state READ state NOTIFY stateChanged);
/// Health of the device as a percentage of its original health.
Q_PROPERTY(qreal healthPercentage READ healthPercentage NOTIFY healthPercentageChanged);
Q_PROPERTY(bool healthSupported READ healthSupported NOTIFY healthSupportedChanged);

View file

@ -13,6 +13,7 @@ namespace qs::hyprland::ipc {
class HyprlandMonitor: public QObject {
Q_OBJECT;
// clang-format off
Q_PROPERTY(qint32 id READ id NOTIFY idChanged);
Q_PROPERTY(QString name READ name NOTIFY nameChanged);
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged);
@ -28,7 +29,8 @@ class HyprlandMonitor: public QObject {
/// > property, run @@Hyprland.refreshMonitors() and wait for this property to update.
Q_PROPERTY(QVariantMap lastIpcObject READ lastIpcObject NOTIFY lastIpcObjectChanged);
/// The currently active workspace on this monitor. May be null.
Q_PROPERTY(HyprlandWorkspace* activeWorkspace READ activeWorkspace NOTIFY activeWorkspaceChanged);
Q_PROPERTY(qs::hyprland::ipc::HyprlandWorkspace* activeWorkspace READ activeWorkspace NOTIFY activeWorkspaceChanged);
// clang-format on
QML_ELEMENT;
QML_UNCREATABLE("HyprlandMonitors must be retrieved from the HyprlandIpc object.");

View file

@ -14,16 +14,18 @@ namespace qs::hyprland::ipc {
class HyprlandIpcQml: public QObject {
Q_OBJECT;
// clang-format off
/// Path to the request socket (.socket.sock)
Q_PROPERTY(QString requestSocketPath READ requestSocketPath CONSTANT);
/// Path to the event socket (.socket2.sock)
Q_PROPERTY(QString eventSocketPath READ eventSocketPath CONSTANT);
/// The currently focused hyprland monitor. May be null.
Q_PROPERTY(HyprlandMonitor* focusedMonitor READ focusedMonitor NOTIFY focusedMonitorChanged);
Q_PROPERTY(qs::hyprland::ipc::HyprlandMonitor* focusedMonitor READ focusedMonitor NOTIFY focusedMonitorChanged);
/// All hyprland monitors.
Q_PROPERTY(ObjectModel<HyprlandMonitor>* monitors READ monitors CONSTANT);
Q_PROPERTY(ObjectModel<qs::hyprland::ipc::HyprlandMonitor>* monitors READ monitors CONSTANT);
/// All hyprland workspaces.
Q_PROPERTY(ObjectModel<HyprlandWorkspace>* workspaces READ workspaces CONSTANT);
Q_PROPERTY(ObjectModel<qs::hyprland::ipc::HyprlandWorkspace>* workspaces READ workspaces CONSTANT);
// clang-format on
QML_NAMED_ELEMENT(Hyprland);
QML_SINGLETON;

View file

@ -24,7 +24,7 @@ class Toplevel: public QObject {
Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged);
Q_PROPERTY(QString title READ title NOTIFY titleChanged);
/// Parent toplevel if this toplevel is a modal/dialog, otherwise null.
Q_PROPERTY(Toplevel* parent READ parent NOTIFY parentChanged);
Q_PROPERTY(qs::wayland::toplevel_management::Toplevel* parent READ parent NOTIFY parentChanged);
/// If the window is currently activated or focused.
///
/// Activation can be requested with the @@activate() function.
@ -141,13 +141,15 @@ private:
/// wayland protocol.
class ToplevelManagerQml: public QObject {
Q_OBJECT;
// clang-format off
/// All toplevel windows exposed by the compositor.
Q_PROPERTY(ObjectModel<Toplevel>* toplevels READ toplevels CONSTANT);
Q_PROPERTY(ObjectModel<qs::wayland::toplevel_management::Toplevel>* toplevels READ toplevels CONSTANT);
/// Active toplevel or null.
///
/// > [!INFO] If multiple are active, this will be the most recently activated one.
/// > Usually compositors will not report more than one toplevel as active at a time.
Q_PROPERTY(Toplevel* activeToplevel READ activeToplevel NOTIFY activeToplevelChanged);
Q_PROPERTY(qs::wayland::toplevel_management::Toplevel* activeToplevel READ activeToplevel NOTIFY activeToplevelChanged);
// clang-format on
QML_NAMED_ELEMENT(ToplevelManager);
QML_SINGLETON;