Debian Codegraph @

src/libs/widgets/KoVBox.h

raw
1 /* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2005 David Faure <[email protected]>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5 */
6
7 #ifndef KoVBOX_H
8 #define KoVBOX_H
9
10 #include <kowidgets_export.h>
11
12 #include <QFrame>
13
14 class QChildEvent;
15
16 /**
17 * A container widget which arranges its children vertically.
18 *
19 * When using a KoVBox you don't need to create a layout nor
20 * to add the child widgets to it.
21 *
22 * Both margin and spacing are initialized to 0. Use QHBoxLayout
23 * if you need standard layout margins.
24 *
25 * @see KVBox
26 */
27 class KOWIDGETS_EXPORT KoVBox : public QFrame
28 {
29 Q_OBJECT
30
31 public:
32 /**
33 * Creates a new hbox.
34 */
35 explicit KoVBox(QWidget *parent = nullptr);
36
37 /**
38 * Destructor.
39 */
40 ~KoVBox() override;
41
42 /**
43 * Sets the @p margin of the hbox.
44 */
45 void setMargin(int margin);
46
47 /**
48 * Sets the spacing between the child widgets to @p space.
49 *
50 * To get the default layout spacing, set @p space to -1.
51 */
52 void setSpacing(int space);
53
54 /**
55 * Sets the stretch factor of @p widget to @p stretch.
56 */
57 void setStretchFactor(QWidget *widget, int stretch);
58
59 /**
60 * Calculate the recommended size for this hbox.
61 */
62 QSize sizeHint() const override;
63
64 /**
65 * Calculate the recommended minimum size for this hbox.
66 */
67 QSize minimumSizeHint() const override;
68
69 protected:
70
71 void childEvent(QChildEvent *ev) override;
72
73 private:
74 class Private;
75 friend class Private;
76 Private *const d;
77
78 Q_DISABLE_COPY(KoVBox)
79 };
80
81 #endif