forked from quickshell/quickshell
		
	all: use UntypedObjectModel instead of ObjectModel in Q_PROPERTY
Fixes qmllint/qmlls type deduction for ObjectModels
This commit is contained in:
		
							parent
							
								
									746b0e70d7
								
							
						
					
					
						commit
						98cdb87181
					
				
					 9 changed files with 33 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -9,6 +9,7 @@
 | 
			
		|||
#include <qqmlintegration.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "doc.hpp"
 | 
			
		||||
#include "model.hpp"
 | 
			
		||||
 | 
			
		||||
class DesktopAction;
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +140,8 @@ private:
 | 
			
		|||
class DesktopEntries: public QObject {
 | 
			
		||||
	Q_OBJECT;
 | 
			
		||||
	/// All desktop entries of type Application that are not Hidden or NoDisplay.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<DesktopEntry>* applications READ applications CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<DesktopEntry>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* applications READ applications CONSTANT);
 | 
			
		||||
	QML_ELEMENT;
 | 
			
		||||
	QML_SINGLETON;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,3 +18,6 @@
 | 
			
		|||
 | 
			
		||||
// overridden properties
 | 
			
		||||
#define QSDOC_PROPERTY_OVERRIDE(...)
 | 
			
		||||
 | 
			
		||||
// override types of properties for docs
 | 
			
		||||
#define QSDOC_TYPE_OVERRIDE(type)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
#include <qqmllist.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "player.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,8 @@ class MprisQml: public QObject {
 | 
			
		|||
	QML_NAMED_ELEMENT(Mpris);
 | 
			
		||||
	QML_SINGLETON;
 | 
			
		||||
	/// All connected MPRIS players.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<qs::service::mpris::MprisPlayer>* players READ players CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::mpris::MprisPlayer>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* players READ players CONSTANT);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	explicit MprisQml(QObject* parent = nullptr): QObject(parent) {};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
#include <qqmlintegration.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "../../core/reload.hpp"
 | 
			
		||||
#include "notification.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +68,8 @@ 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<qs::service::notifications::Notification>* trackedNotifications READ trackedNotifications NOTIFY trackedNotificationsChanged);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::notifications::Notification>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
#include <qtmetamacros.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "link.hpp"
 | 
			
		||||
#include "node.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +60,8 @@ 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<qs::service::pipewire::PwNodeIface>* nodes READ nodes CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::pipewire::PwNodeIface>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* nodes READ nodes CONSTANT);
 | 
			
		||||
	/// All links present in pipewire.
 | 
			
		||||
	///
 | 
			
		||||
	/// Links connect pipewire nodes to each other, and can be used to determine
 | 
			
		||||
| 
						 | 
				
			
			@ -70,14 +72,16 @@ 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<qs::service::pipewire::PwLinkIface>* links READ links CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::pipewire::PwLinkIface>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* 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<qs::service::pipewire::PwLinkGroupIface>* linkGroups READ linkGroups CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::pipewire::PwLinkGroupIface>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@
 | 
			
		|||
#include <qtclasshelpermacros.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "item.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +126,8 @@ signals:
 | 
			
		|||
class SystemTray: public QObject {
 | 
			
		||||
	Q_OBJECT;
 | 
			
		||||
	/// List of all system tray icons.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<SystemTrayItem>* items READ items CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<SystemTrayItem>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* items READ items CONSTANT);
 | 
			
		||||
	QML_ELEMENT;
 | 
			
		||||
	QML_SINGLETON;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
#include <qqmllist.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "../../dbus/properties.hpp"
 | 
			
		||||
#include "dbus_service.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +61,8 @@ class UPowerQml: public QObject {
 | 
			
		|||
	/// It is typically the device that is used for displaying information in desktop environments.
 | 
			
		||||
	Q_PROPERTY(qs::service::upower::UPowerDevice* displayDevice READ displayDevice NOTIFY displayDeviceChanged);
 | 
			
		||||
	/// All connected UPower devices.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<qs::service::upower::UPowerDevice>* devices READ devices CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::service::upower::UPowerDevice>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@
 | 
			
		|||
#include <qqmlintegration.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../../core/doc.hpp"
 | 
			
		||||
#include "../../../core/model.hpp"
 | 
			
		||||
#include "../../../core/qmlscreen.hpp"
 | 
			
		||||
#include "connection.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -22,9 +23,11 @@ class HyprlandIpcQml: public QObject {
 | 
			
		|||
	/// The currently focused hyprland monitor. May be null.
 | 
			
		||||
	Q_PROPERTY(qs::hyprland::ipc::HyprlandMonitor* focusedMonitor READ focusedMonitor NOTIFY focusedMonitorChanged);
 | 
			
		||||
	/// All hyprland monitors.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<qs::hyprland::ipc::HyprlandMonitor>* monitors READ monitors CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::hyprland::ipc::HyprlandMonitor>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* monitors READ monitors CONSTANT);
 | 
			
		||||
	/// All hyprland workspaces.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<qs::hyprland::ipc::HyprlandWorkspace>* workspaces READ workspaces CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::hyprland::ipc::HyprlandWorkspace>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* workspaces READ workspaces CONSTANT);
 | 
			
		||||
	// clang-format on
 | 
			
		||||
	QML_NAMED_ELEMENT(Hyprland);
 | 
			
		||||
	QML_SINGLETON;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <qqmlintegration.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
#include "../../core/doc.hpp"
 | 
			
		||||
#include "../../core/model.hpp"
 | 
			
		||||
#include "../../core/qmlscreen.hpp"
 | 
			
		||||
#include "../../core/util.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +144,8 @@ class ToplevelManagerQml: public QObject {
 | 
			
		|||
	Q_OBJECT;
 | 
			
		||||
	// clang-format off
 | 
			
		||||
	/// All toplevel windows exposed by the compositor.
 | 
			
		||||
	Q_PROPERTY(ObjectModel<qs::wayland::toplevel_management::Toplevel>* toplevels READ toplevels CONSTANT);
 | 
			
		||||
	QSDOC_TYPE_OVERRIDE(ObjectModel<qs::wayland::toplevel_management::Toplevel>*);
 | 
			
		||||
	Q_PROPERTY(UntypedObjectModel* toplevels READ toplevels CONSTANT);
 | 
			
		||||
	/// Active toplevel or null.
 | 
			
		||||
	///
 | 
			
		||||
	/// > [!INFO] If multiple are active, this will be the most recently activated one.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue