DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dboxwidget.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBOXWIDGET_H
6#define DBOXWIDGET_H
7
8#include <dtkwidget_global.h>
9
10#include <dobject.h>
11
12#include <QFrame>
13#include <QBoxLayout>
14
15DWIDGET_BEGIN_NAMESPACE
16
17class DBoxWidgetPrivate;
18class DBoxWidget : public QFrame, public DTK_CORE_NAMESPACE::DObject
19{
20 Q_OBJECT
21
22 Q_PROPERTY(QBoxLayout::Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
23
24public:
25 explicit DBoxWidget(QBoxLayout::Direction direction, QWidget *parent = 0);
26
27 QBoxLayout::Direction direction() const;
28 QBoxLayout *layout() const;
29
30 void addWidget(QWidget *widget);
31 QSize sizeHint() const Q_DECL_OVERRIDE;
32
33public Q_SLOTS:
34 void setDirection(QBoxLayout::Direction direction);
35
36Q_SIGNALS:
37 void sizeChanged(QSize size);
38 void directionChanged(QBoxLayout::Direction direction);
39
40protected:
41 virtual void updateSize(const QSize &size);
42 bool event(QEvent *ee) Q_DECL_OVERRIDE;
43
44private:
45 D_DECLARE_PRIVATE(DBoxWidget)
46};
47
48class DHBoxWidget : public DBoxWidget
49{
50 Q_OBJECT
51public:
52 explicit DHBoxWidget(QWidget *parent = 0);
53};
54
55class DVBoxWidget : public DBoxWidget
56{
57 Q_OBJECT
58public:
59 explicit DVBoxWidget(QWidget *parent = 0);
60};
61
62DWIDGET_END_NAMESPACE
63
64#endif // DBOXWIDGET_H
DBoxWidget提供了一个自适应子控件大小的Widget
Definition dboxwidget.h:19
设置成水平方向的DBoxWidget
Definition dboxwidget.h:49
设置成垂直方向的DBoxWidget
Definition dboxwidget.h:56