File indexing completed on 2024-05-05 04:46:52
0001 #pragma once 0002 0003 #include <QObject> 0004 #include <QQmlEngine> 0005 0006 /** 0007 * @brief The Controls class. 0008 * 0009 * This object exposes a series of attached properties useful for the MauiKit controls. 0010 * 0011 * @note This is mean to be used as an attached property. It can be consumed as `Maui.Controls`, for example, `Maui.Controls.showCSD` 0012 */ 0013 class Controls : public QObject 0014 { 0015 Q_OBJECT 0016 QML_ELEMENT 0017 QML_ATTACHED(Controls) 0018 QML_UNCREATABLE("Cannot be created Controls") 0019 0020 /** 0021 * A title text that can be attached to any control. 0022 */ 0023 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) 0024 0025 /** 0026 * Whether a supported MauiKit controls should display the window control buttons when using CSD. 0027 */ 0028 Q_PROPERTY(bool showCSD READ showCSD WRITE setShowCSD NOTIFY showCSDChanged) 0029 0030 public: 0031 explicit Controls(QObject *parent = nullptr); 0032 0033 static Controls *qmlAttachedProperties(QObject *object); 0034 0035 bool showCSD() const; 0036 void setShowCSD(bool newShowCSD); 0037 0038 QString title() const; 0039 void setTitle(const QString &title); 0040 0041 Q_SIGNALS: 0042 void titleChanged(); 0043 void showCSDChanged(); 0044 0045 private: 0046 bool m_showCSD; 0047 QString m_title; 0048 }; 0049