MauiKit Controls

android/blurhelper/windowblur.cpp
1/*
2 * Copyright (C) 2021 CutefishOS Team.
3 *
4 * Author: cutefish <cutefishos@foxmail.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "windowblur.h"
21
22#include <QGuiApplication>
23#include <QPainterPath>
24#include <QScreen>
25#include <QDebug>
26
27WindowBlur::WindowBlur(QObject *parent) noexcept
28 : QObject(parent)
29 , m_view(nullptr)
30 , m_enabled(false)
31 , m_windowRadius(0.0)
32{
33}
34
35WindowBlur::~WindowBlur()
36{
37}
38
39void WindowBlur::classBegin()
40{
41}
42
43void WindowBlur::componentComplete()
44{
45 updateBlur();
46}
47
48void WindowBlur::setView(QWindow *view)
49{
50 if (view != m_view) {
51 m_view = view;
52 updateBlur();
53 emit viewChanged();
54
55 connect(m_view, &QWindow::visibleChanged, this, &WindowBlur::onViewVisibleChanged);
56 }
57}
58
59QWindow* WindowBlur::view() const
60{
61 return m_view;
62}
63
64void WindowBlur::setGeometry(const QRect &rect)
65{
66 if (rect != m_rect) {
67 m_rect = rect;
68 updateBlur();
69 emit geometryChanged();
70 }
71}
72
73QRect WindowBlur::geometry() const
74{
75 return m_rect;
76}
77
78void WindowBlur::setEnabled(bool enabled)
79{
80 if (enabled != m_enabled) {
81 m_enabled = enabled;
82 updateBlur();
83 emit enabledChanged();
84 }
85}
86
87bool WindowBlur::enabled() const
88{
89 return m_enabled;
90}
91
92void WindowBlur::setWindowRadius(qreal radius)
93{
94 if (radius != m_windowRadius) {
95 m_windowRadius = radius;
96 updateBlur();
97 emit windowRadiusChanged();
98 }
99}
100
101qreal WindowBlur::windowRadius() const
102{
103 return m_windowRadius;
104}
105
106void WindowBlur::onViewVisibleChanged(bool visible)
107{
108 if (visible)
109 updateBlur();
110}
111
112void WindowBlur::updateBlur()
113{
114 if (!m_view)
115 return;
116
117 qWarning() << "not implement";
118}
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void visibleChanged(bool arg)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.