Move Controller::setBlur and Controller::hasWindowSystem to WindowController

This commit is contained in:
Tobias Fella
2023-10-30 21:24:39 +01:00
parent 33c5b418d2
commit 5df4fa297d
6 changed files with 56 additions and 48 deletions

View File

@@ -4,8 +4,12 @@
#pragma once
#include <QObject>
#include <QWindow>
#include <QQmlEngine>
#include <QQuickItem>
#include <QQuickWindow>
#ifdef HAVE_WINDOWSYSTEM
#include <KWindowEffects>
#endif
/**
* @class WindowController
*
@@ -14,9 +18,21 @@
class WindowController : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
/**
* @brief Whether KWindowSystem specific features are available.
*/
Q_PROPERTY(bool hasWindowSystem READ hasWindowSystem CONSTANT)
public:
static WindowController &instance();
static WindowController *create(QQmlEngine *engine, QJSEngine *)
{
engine->setObjectOwnership(&instance(), QQmlEngine::CppOwnership);
return &instance();
}
/**
* @brief Set the window that the will be managed.
@@ -43,6 +59,13 @@ public:
*/
void showAndRaiseWindow(const QString &startupId);
bool hasWindowSystem() const;
/**
* @brief Set the background blur status of the given item.
*/
Q_INVOKABLE void setBlur(QQuickItem *item, bool blur);
Q_SIGNALS:
/**
* @brief Triggered if the managed window is changed.