Baloo Widgets

kblocklayout.h
1 /*
2  * This file is part of the Baloo KDE project.
3  * Copyright (C) 2006-2007 Sebastian Trueg <[email protected]>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 /*
22  KBlockLayout is based on the FlowLayout example from QT4.
23  Copyright (C) 2004-2006 Trolltech ASA. All rights reserved.
24 */
25 
26 #ifndef KBLOCKLAYOUT_H
27 #define KBLOCKLAYOUT_H
28 
29 #include <QLayout>
30 #include <QLayoutItem>
31 
32 /**
33  * The KBlockLayout arranges widget in rows and columns like a text
34  * editor does.
35  */
36 class KBlockLayout : public QLayout
37 {
38  public:
39  explicit KBlockLayout( QWidget *parent, int margin = 0, int hSpacing = -1, int vSpacing = -1 );
40  explicit KBlockLayout( int margin = 0, int hSpacing = -1, int vSpacing = -1 );
41  ~KBlockLayout() override;
42 
43  /**
44  * Set the alignment to use. It can be a combination of a horizontal and
45  * a vertical alignment flag. The vertical flag is used to arrange widgets
46  * that do not fill the complete height of a row.
47  *
48  * The default alignment is Qt::AlignLeft|Qt::AlignTop
49  */
51  Qt::Alignment alignment() const;
52 
53  int horizontalSpacing() const;
54  int verticalSpacing() const;
55 
56  void setSpacing( int h, int v );
57 
58  void addItem( QLayoutItem* item ) override;
59  Qt::Orientations expandingDirections() const override;
60  bool hasHeightForWidth() const override;
61  int heightForWidth(int) const override;
62  int count() const override;
63  QLayoutItem* itemAt( int index ) const override;
64  QSize minimumSize() const override;
65  void setGeometry( const QRect& rect ) override;
66  QSize sizeHint() const override;
67  QLayoutItem* takeAt( int index ) override;
68 
69  private:
70  int doLayout( const QRect& rect, bool testOnly ) const;
71 
72  class Private;
73  Private* const d;
74 };
75 
76 #endif
void setAlignment(Qt::Alignment)
Set the alignment to use.
typedef Alignment
The KBlockLayout arranges widget in rows and columns like a text editor does.
Definition: kblocklayout.h:36
typedef Orientations
QObject * parent() const const
int margin() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:07:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.