DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dbackgroundgroup.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBACKGROUNDGROUP_H
6#define DBACKGROUNDGROUP_H
7
8#include <dtkwidget_global.h>
9#include <DObject>
10
11#include <QWidget>
12
13DWIDGET_BEGIN_NAMESPACE
14
15class DBackgroundGroupPrivate;
16class LIBDTKWIDGETSHARED_EXPORT DBackgroundGroup : public QWidget, public DTK_CORE_NAMESPACE::DObject
17{
18 Q_OBJECT
19 D_DECLARE_PRIVATE(DBackgroundGroup)
20
21 Q_PROPERTY(QMargins itemMargins READ itemMargins WRITE setItemMargins)
22 Q_PROPERTY(bool useWidgetBackground READ useWidgetBackground WRITE setUseWidgetBackground NOTIFY useWidgetBackgroundChanged)
23
24public:
25 explicit DBackgroundGroup(QLayout *layout = nullptr, QWidget *parent = nullptr);
26
27 QMargins itemMargins() const;
28 bool useWidgetBackground() const;
29
30 void setLayout(QLayout *layout);
31
32 void setBackgroundRole(QPalette::ColorRole role);
33 QPalette::ColorRole backgroundRole() const;
34
35public Q_SLOTS:
36 void setItemMargins(QMargins itemMargins);
37 void setItemSpacing(int spacing);
38 void setUseWidgetBackground(bool useWidgetBackground);
39
40Q_SIGNALS:
41 void useWidgetBackgroundChanged(bool useWidgetBackground);
42
43protected:
44 void paintEvent(QPaintEvent *event) override;
45 bool event(QEvent *event) override;
46
47private:
48 using QWidget::setLayout;
49 using QWidget::setAutoFillBackground;
50};
51
52DWIDGET_END_NAMESPACE
53
54#endif // DBACKGROUNDGROUP_H
DBackgroundGroup提供了将布局控件改成圆角边框(将布局看成一个整体)
Definition dbackgroundgroup.h:17