Baloo Widgets

kblocklayout.h
1/*
2 SPDX-FileCopyrightText: 2006-2007 Sebastian Trueg <trueg@kde.org>
3
4 KBlockLayout is based on the FlowLayout example from QT4.
5 SPDX-FileCopyrightText: 2004-2006 Trolltech ASA.
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#ifndef KBLOCKLAYOUT_H
11#define KBLOCKLAYOUT_H
12
13#include <QLayout>
14#include <QLayoutItem>
15
16/**
17 * The KBlockLayout arranges widget in rows and columns like a text
18 * editor does.
19 */
20class KBlockLayout : public QLayout
21{
22public:
23 explicit KBlockLayout(QWidget *parent, int margin = 0, int hSpacing = -1, int vSpacing = -1);
24 explicit KBlockLayout(int margin = 0, int hSpacing = -1, int vSpacing = -1);
25 ~KBlockLayout() override;
26
27 /**
28 * Set the alignment to use. It can be a combination of a horizontal and
29 * a vertical alignment flag. The vertical flag is used to arrange widgets
30 * that do not fill the complete height of a row.
31 *
32 * The default alignment is Qt::AlignLeft|Qt::AlignTop
33 */
35 Qt::Alignment alignment() const;
36
37 int horizontalSpacing() const;
38 int verticalSpacing() const;
39
40 void setSpacing(int h, int v);
41
42 void addItem(QLayoutItem *item) override;
43 Qt::Orientations expandingDirections() const override;
44 bool hasHeightForWidth() const override;
45 int heightForWidth(int) const override;
46 int count() const override;
47 QLayoutItem *itemAt(int index) const override;
48 QSize minimumSize() const override;
49 void setGeometry(const QRect &rect) override;
50 QSize sizeHint() const override;
51 QLayoutItem *takeAt(int index) override;
52
53private:
54 int doLayout(const QRect &rect, bool testOnly) const;
55 int getMargin() const;
56
57 class Private;
58 Private *const d;
59};
60
61#endif
The KBlockLayout arranges widget in rows and columns like a text editor does.
void setAlignment(Qt::Alignment)
Set the alignment to use.
QObject * parent() const const
typedef Alignment
typedef Orientations
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.