CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Properties | List of all members
ctkFlowLayout Class Reference

#include <Libs/Widgets/ctkFlowLayout.h>

Inheritance diagram for ctkFlowLayout:
Inheritance graph
[legend]
Collaboration diagram for ctkFlowLayout:
Collaboration graph
[legend]

Public Types

typedef QLayout Superclass
 

Public Member Functions

virtual void addItem (QLayoutItem *item)
 Reimplemented for internal reasons. More...
 
bool alignItems () const
 
virtual int count () const
 
 ctkFlowLayout ()
 
 ctkFlowLayout (Qt::Orientation orientation, QWidget *parent=0)
 
 ctkFlowLayout (QWidget *parent)
 
virtual Qt::Orientations expandingDirections () const
 
virtual bool hasHeightForWidth () const
 
virtual bool hasWidthForHeight () const
 
virtual int heightForWidth (int) const
 
int horizontalSpacing () const
 
virtual QLayoutItem * itemAt (int index) const
 
virtual QSize minimumSize () const
 
Qt::Orientation orientation () const
 
Qt::Orientations preferredExpandingDirections () const
 
void setAlignItems (bool)
 
virtual void setGeometry (const QRect &rect)
 
void setHorizontalSpacing (int)
 
void setOrientation (Qt::Orientation orientation)
 
void setPreferredExpandingDirections (Qt::Orientations directions)
 
void setVerticalSpacing (int)
 
virtual QSize sizeHint () const
 
virtual QLayoutItem * takeAt (int index)
 
int verticalSpacing () const
 
virtual int widthForHeight (int) const
 
virtual ~ctkFlowLayout ()
 

Static Public Member Functions

static ctkFlowLayoutreplaceLayout (QWidget *widget)
 

Protected Attributes

QScopedPointer< ctkFlowLayoutPrivate > d_ptr
 

Properties

bool alignItems
 
int horizontalSpacing
 
Qt::Orientation orientation
 
Qt::Orientations preferredExpandingDirections
 
int verticalSpacing
 

Detailed Description

Acts like a QBoxLayout but if the space is horizontally/vertically limited, it displays items ona a new row/column based on the orientation. Please note that using a Qt::Vertical orientation without the property alignItems set to true might result to weird layout behavior.

Definition at line 36 of file ctkFlowLayout.h.

Member Typedef Documentation

◆ Superclass

typedef QLayout ctkFlowLayout::Superclass

Definition at line 76 of file ctkFlowLayout.h.

Constructor & Destructor Documentation

◆ ctkFlowLayout() [1/3]

ctkFlowLayout::ctkFlowLayout ( Qt::Orientation  orientation,
QWidget *  parent = 0 
)
explicit

◆ ctkFlowLayout() [2/3]

ctkFlowLayout::ctkFlowLayout ( QWidget *  parent)
explicit

◆ ctkFlowLayout() [3/3]

ctkFlowLayout::ctkFlowLayout ( )
explicit

◆ ~ctkFlowLayout()

virtual ctkFlowLayout::~ctkFlowLayout ( )
virtual

Member Function Documentation

◆ addItem()

virtual void ctkFlowLayout::addItem ( QLayoutItem *  item)
virtual

Reimplemented for internal reasons.

◆ alignItems()

bool ctkFlowLayout::alignItems ( ) const

◆ count()

virtual int ctkFlowLayout::count ( ) const
virtual

◆ expandingDirections()

virtual Qt::Orientations ctkFlowLayout::expandingDirections ( ) const
virtual

◆ hasHeightForWidth()

virtual bool ctkFlowLayout::hasHeightForWidth ( ) const
virtual

◆ hasWidthForHeight()

virtual bool ctkFlowLayout::hasWidthForHeight ( ) const
virtual

When the orientation is Qt::Vertical, heightForWidth doesn't work correctly with ctkFlowLayout. Ideally widthForHeight should be used instead.

See also
orientation widthForHeight hasHeightForWidth

◆ heightForWidth()

virtual int ctkFlowLayout::heightForWidth ( int  ) const
virtual

◆ horizontalSpacing()

int ctkFlowLayout::horizontalSpacing ( ) const

◆ itemAt()

virtual QLayoutItem* ctkFlowLayout::itemAt ( int  index) const
virtual

◆ minimumSize()

virtual QSize ctkFlowLayout::minimumSize ( ) const
virtual

◆ orientation()

Qt::Orientation ctkFlowLayout::orientation ( ) const

◆ preferredExpandingDirections()

Qt::Orientations ctkFlowLayout::preferredExpandingDirections ( ) const

◆ replaceLayout()

static ctkFlowLayout* ctkFlowLayout::replaceLayout ( QWidget *  widget)
static

Replace the existing BoxLayout of the widget with a flow layout. When using the Designer, it is not possible to use a flow layout. Instead, you can use a H/VBoxLayout and replace it programatically in the setupUi() function with a flow layout. replaceLayout() makes the operation easier.

Todo:
replaceLayout should take an existing layout instead of a widget, indeed, a layout can have another layout as a parent, not only a widget.

◆ setAlignItems()

void ctkFlowLayout::setAlignItems ( bool  )

◆ setGeometry()

virtual void ctkFlowLayout::setGeometry ( const QRect &  rect)
virtual

◆ setHorizontalSpacing()

void ctkFlowLayout::setHorizontalSpacing ( int  )

◆ setOrientation()

void ctkFlowLayout::setOrientation ( Qt::Orientation  orientation)

◆ setPreferredExpandingDirections()

void ctkFlowLayout::setPreferredExpandingDirections ( Qt::Orientations  directions)

◆ setVerticalSpacing()

void ctkFlowLayout::setVerticalSpacing ( int  )

◆ sizeHint()

virtual QSize ctkFlowLayout::sizeHint ( ) const
virtual

◆ takeAt()

virtual QLayoutItem* ctkFlowLayout::takeAt ( int  index)
virtual

◆ verticalSpacing()

int ctkFlowLayout::verticalSpacing ( ) const

◆ widthForHeight()

virtual int ctkFlowLayout::widthForHeight ( int  ) const
virtual

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkFlowLayoutPrivate> ctkFlowLayout::d_ptr
protected

Definition at line 127 of file ctkFlowLayout.h.

Property Documentation

◆ alignItems

bool ctkFlowLayout::alignItems
readwrite

Force the items to be horizontally aligned based on the largest item to display. True by default.

See also
orientation

Definition at line 1 of file ctkFlowLayout.h.

◆ horizontalSpacing

int ctkFlowLayout::horizontalSpacing
readwrite

Horizontal space between items, if the spacing is <0, a default spacing set on the parent/style is used. -1 by default.

See also
verticalSpacing

Definition at line 1 of file ctkFlowLayout.h.

◆ orientation

Qt::Orientation ctkFlowLayout::orientation
readwrite

If orientation is Qt::Horizontal, items are layed out from left to right then top to bottom if there is no more horizontal space. If orientation is Qt::Vertical, items are layed out from top to bottom then left to right if there is no more vertical space. Qt::Horizontal by default

See also
preferredExpandingDirections

Definition at line 1 of file ctkFlowLayout.h.

◆ preferredExpandingDirections

Qt::Orientations ctkFlowLayout::preferredExpandingDirections
readwrite

Indicates how the size hint of the layout should behave. The preferred expanding direction can be different than the orientation of the layout. It can be a combination of Qt::Horizontal and Qt::Vertical, in that case the layout will try to expand in a square shape (evenly distribute the number of rows and columns). Qt::Horizontal | Qt::Vertical by default.

See also
orientation

Definition at line 1 of file ctkFlowLayout.h.

◆ verticalSpacing

int ctkFlowLayout::verticalSpacing
readwrite

Vertical space between items, if the spacing is <0, a default spacing set on the parent/style is used. -1 by default.

See also
horizontalSpacing

Definition at line 1 of file ctkFlowLayout.h.


The documentation for this class was generated from the following file: