CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkFlowLayout.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkFlowLayout_h
22#define __ctkFlowLayout_h
23
24// Qt includes
25#include <QLayout>
26
27// CTK includes
28#include "ctkWidgetsExport.h"
29class ctkFlowLayoutPrivate;
30
36class CTK_WIDGETS_EXPORT ctkFlowLayout : public QLayout
37{
38 Q_OBJECT
45 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
46
47
55 Q_PROPERTY(Qt::Orientations preferredExpandingDirections READ preferredExpandingDirections WRITE setPreferredExpandingDirections)
56
61 Q_PROPERTY(bool alignItems READ alignItems WRITE setAlignItems)
62
67 Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
68
73 Q_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
74
75public:
76 typedef QLayout Superclass;
77 explicit ctkFlowLayout(Qt::Orientation orientation, QWidget* parent = 0);
78 explicit ctkFlowLayout(QWidget* parent);
79 explicit ctkFlowLayout();
80 virtual ~ctkFlowLayout();
81
82 void setOrientation(Qt::Orientation orientation);
83 Qt::Orientation orientation()const;
84
85 void setPreferredExpandingDirections(Qt::Orientations directions);
86 Qt::Orientations preferredExpandingDirections()const;
87
88 int horizontalSpacing() const;
89 void setHorizontalSpacing(int);
90
91 int verticalSpacing() const;
92 void setVerticalSpacing(int);
93
94 bool alignItems()const;
95 void setAlignItems(bool);
96
105 static ctkFlowLayout* replaceLayout(QWidget* widget);
106
111 virtual bool hasWidthForHeight() const;
112 virtual int widthForHeight(int) const;
113
115 virtual void addItem(QLayoutItem *item);
116 virtual Qt::Orientations expandingDirections() const;
117 virtual bool hasHeightForWidth() const;
118 virtual int heightForWidth(int) const;
119 virtual int count() const;
120 virtual QLayoutItem *itemAt(int index) const;
121 virtual QSize minimumSize() const;
122 virtual void setGeometry(const QRect &rect);
123 virtual QSize sizeHint() const;
124 virtual QLayoutItem *takeAt(int index);
125
126protected:
127 QScopedPointer<ctkFlowLayoutPrivate> d_ptr;
128
129private:
130 Q_DECLARE_PRIVATE(ctkFlowLayout);
131 Q_DISABLE_COPY(ctkFlowLayout);
132};
133
134#endif
QLayout Superclass