digiKam
dynamiclayout.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-10-22
7  * Description : a dynamic layout manager
8  *
9  * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DYNAMIC_LAYOUT_H
25 #define DIGIKAM_DYNAMIC_LAYOUT_H
26 
27 // Qt includes
28 
29 #include <QLayout>
30 
31 class QLayoutItem;
32 class QRect;
33 class QWidget;
34 
35 namespace Digikam
36 {
37 
38 class DynamicLayout : public QLayout
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit DynamicLayout(QWidget* const parent, int margin = -1,
45  int hSpacing = 0, int vSpacing = 0);
46  explicit DynamicLayout(int margin = -1, int hSpacing = 0,
47  int vSpacing = 0);
48  ~DynamicLayout() override;
49 
50  void addItem(QLayoutItem* layItem) override;
51 
52  int horizontalSpacing() const;
53  int verticalSpacing() const;
54 
55  Qt::Orientations expandingDirections() const override;
56 
57  bool hasHeightForWidth() const override;
58  int heightForWidth(int) const override;
59 
60  int count() const override;
61 
62  QLayoutItem* itemAt(int index) const override;
63  QLayoutItem* takeAt(int index) override;
64 
65  QSize minimumSize() const override;
66 
67  void setGeometry(const QRect& rect) override;
68  QSize sizeHint() const override;
69 
70 
71 private:
72 
73  int reLayout(const QRect& rect,
74  bool testOnly) const;
75 
76 private:
77 
78  // Disable
79  DynamicLayout(const DynamicLayout&) = delete;
80  DynamicLayout& operator=(const DynamicLayout&) = delete;
81 
82 private:
83 
84  class Private;
85  Private* const d;
86 };
87 
88 } // namespace Digikam
89 
90 #endif // DIGIKAM_DYNAMIC_LAYOUT_H
Definition: dynamiclayout.h:39
int verticalSpacing() const
Definition: dynamiclayout.cpp:112
QLayoutItem * takeAt(int index) override
Definition: dynamiclayout.cpp:127
void addItem(QLayoutItem *layItem) override
Definition: dynamiclayout.cpp:85
int count() const override
Definition: dynamiclayout.cpp:117
int horizontalSpacing() const
Definition: dynamiclayout.cpp:107
void setGeometry(const QRect &rect) override
Definition: dynamiclayout.cpp:156
QSize minimumSize() const override
Definition: dynamiclayout.cpp:167
QLayoutItem * itemAt(int index) const override
Definition: dynamiclayout.cpp:122
Qt::Orientations expandingDirections() const override
Definition: dynamiclayout.cpp:139
~DynamicLayout() override
Definition: dynamiclayout.cpp:73
QSize sizeHint() const override
Definition: dynamiclayout.cpp:162
bool hasHeightForWidth() const override
Definition: dynamiclayout.cpp:144
int heightForWidth(int) const override
Definition: dynamiclayout.cpp:149
DynamicLayout(QWidget *const parent, int margin=-1, int hSpacing=0, int vSpacing=0)
Definition: dynamiclayout.cpp:60
Definition: datefolderview.cpp:43