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 
48  Q_PROPERTY(Qt::Orientations preferredExpandingDirections READ preferredExpandingDirections WRITE setPreferredExpandingDirections)
56 
57 
58  Q_PROPERTY(bool alignItems READ alignItems WRITE setAlignItems)
62 
63 
64  Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
68 
69 
70  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
ctkFlowLayout::~ctkFlowLayout
virtual ~ctkFlowLayout()
ctkFlowLayout::ctkFlowLayout
ctkFlowLayout(Qt::Orientation orientation, QWidget *parent=0)
ctkFlowLayout::setAlignItems
void setAlignItems(bool)
ctkFlowLayout::widthForHeight
virtual int widthForHeight(int) const
ctkFlowLayout::minimumSize
virtual QSize minimumSize() const
ctkFlowLayout::itemAt
virtual QLayoutItem * itemAt(int index) const
ctkFlowLayout::horizontalSpacing
int horizontalSpacing() const
ctkFlowLayout::expandingDirections
virtual Qt::Orientations expandingDirections() const
ctkFlowLayout::verticalSpacing
int verticalSpacing() const
ctkFlowLayout::orientation
Qt::Orientation orientation() const
ctkFlowLayout::heightForWidth
virtual int heightForWidth(int) const
ctkFlowLayout::Superclass
QLayout Superclass
Definition: ctkFlowLayout.h:76
ctkFlowLayout::replaceLayout
static ctkFlowLayout * replaceLayout(QWidget *widget)
ctkFlowLayout
Definition: ctkFlowLayout.h:37
ctkFlowLayout::setOrientation
void setOrientation(Qt::Orientation orientation)
ctkFlowLayout::setHorizontalSpacing
void setHorizontalSpacing(int)
ctkFlowLayout::setPreferredExpandingDirections
void setPreferredExpandingDirections(Qt::Orientations directions)
ctkFlowLayout::d_ptr
QScopedPointer< ctkFlowLayoutPrivate > d_ptr
Definition: ctkFlowLayout.h:127
ctkFlowLayout::count
virtual int count() const
ctkFlowLayout::preferredExpandingDirections
Qt::Orientations preferredExpandingDirections() const
ctkFlowLayout::alignItems
bool alignItems() const
ctkFlowLayout::hasWidthForHeight
virtual bool hasWidthForHeight() const
ctkFlowLayout::ctkFlowLayout
ctkFlowLayout(QWidget *parent)
ctkFlowLayout::ctkFlowLayout
ctkFlowLayout()
ctkFlowLayout::addItem
virtual void addItem(QLayoutItem *item)
Reimplemented for internal reasons.
ctkFlowLayout::hasHeightForWidth
virtual bool hasHeightForWidth() const
ctkFlowLayout::setVerticalSpacing
void setVerticalSpacing(int)
ctkFlowLayout::setGeometry
virtual void setGeometry(const QRect &rect)
ctkFlowLayout::takeAt
virtual QLayoutItem * takeAt(int index)
ctkFlowLayout::sizeHint
virtual QSize sizeHint() const