DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dfloatingwidget.h
1// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DFLOATINGWIDGET_H
6#define DFLOATINGWIDGET_H
7
8#include <dtkwidget_global.h>
9#include <DObject>
10
11#include <QWidget>
12
13DWIDGET_BEGIN_NAMESPACE
14
15class DStyleOptionFloatingWidget;
16class DBlurEffectWidget;
17class DFloatingWidgetPrivate;
18class DFloatingWidget : public QWidget, public DTK_CORE_NAMESPACE::DObject
19{
20 Q_OBJECT
21 D_DECLARE_PRIVATE(DFloatingWidget)
22 Q_PROPERTY(bool blurBackgroundEnabled READ blurBackgroundIsEnabled WRITE setBlurBackgroundEnabled)
23
24public:
25 explicit DFloatingWidget(QWidget *parent = nullptr);
26
27 virtual QSize sizeHint() const override;
28 void setWidget(QWidget *widget);
29 void setFramRadius(int radius);
30
31protected:
32 DFloatingWidget(DFloatingWidgetPrivate &dd, QWidget *parent);
33
34 void paintEvent(QPaintEvent* e) override;
35 bool event(QEvent *event) override;
36
37 using QWidget::setContentsMargins;
38 using QWidget::setAutoFillBackground;
39
40public:
41 virtual void initStyleOption(DStyleOptionFloatingWidget *option) const;
42 bool blurBackgroundIsEnabled() const;
43 DBlurEffectWidget *blurBackground() const;
44
45public Q_SLOTS:
46 void setBlurBackgroundEnabled(bool blurBackgroundEnabled);
47};
48
49DWIDGET_END_NAMESPACE
50
51#endif // DFLOATINGWIDGET_H
用于实现主窗口或控件背景的实时模糊效果.
Definition dblureffectwidget.h:17
Definition dfloatingwidget_p.h:19
Definition dfloatingwidget.h:19
Definition dstyleoption.h:157