CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
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"
29 class ctkFlowLayoutPrivate;
30 
36 class 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 
57 
61  Q_PROPERTY(bool alignItems READ alignItems WRITE setAlignItems)
62 
63 
67  Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
68 
69 
73  Q_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
74 
75 public:
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;
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 
126 protected:
127  QScopedPointer<ctkFlowLayoutPrivate> d_ptr;
128 
129 private:
130  Q_DECLARE_PRIVATE(ctkFlowLayout);
131  Q_DISABLE_COPY(ctkFlowLayout);
132 };
133 
134 #endif
void setOrientation(Qt::Orientation orientation)
virtual bool hasHeightForWidth() const
ctkFlowLayout(QWidget *parent)
virtual Qt::Orientations expandingDirections() const
void setVerticalSpacing(int)
virtual bool hasWidthForHeight() const
void setAlignItems(bool)
virtual int count() const
Qt::Orientation orientation() const
int horizontalSpacing() const
bool alignItems() const
virtual QLayoutItem * takeAt(int index)
QScopedPointer< ctkFlowLayoutPrivate > d_ptr
virtual int widthForHeight(int) const
virtual void setGeometry(const QRect &rect)
int verticalSpacing() const
Qt::Orientations preferredExpandingDirections() const
QLayout Superclass
Definition: ctkFlowLayout.h:76
void setPreferredExpandingDirections(Qt::Orientations directions)
virtual void addItem(QLayoutItem *item)
Reimplemented for internal reasons.
ctkFlowLayout(Qt::Orientation orientation, QWidget *parent=0)
void setHorizontalSpacing(int)
virtual ~ctkFlowLayout()
static ctkFlowLayout * replaceLayout(QWidget *widget)
virtual QSize sizeHint() const
virtual int heightForWidth(int) const
virtual QSize minimumSize() const
virtual QLayoutItem * itemAt(int index) const