Classes | Public Member Functions | List of all members
pqHierarchicalGridLayout Class Reference

QLayout specialization that supports a hierarchical layout. More...

#include <pqHierarchicalGridLayout.h>

Inherits QLayout.

Classes

class  Item
 

Public Member Functions

 pqHierarchicalGridLayout (QWidget *parent=nullptr)
 
 ~pqHierarchicalGridLayout () override
 
void setSplitFraction (int location, double splitFraction)
 Specify the split fraction for a location. More...
 
QVector< QWidget * > rearrange (const QVector< Item > &layout)
 API to rearrange the widgets in this layout. More...
 
void addItem (QLayoutItem *item) override
 pure virtual methods from QLayout More...
 
QLayoutItem * itemAt (int index) const override
 pure virtual methods from QLayout More...
 
QLayoutItem * takeAt (int index) override
 pure virtual methods from QLayout More...
 
int count () const override
 pure virtual methods from QLayout More...
 
QSize minimumSize () const override
 recommended overrides from QLayout More...
 
void setGeometry (const QRect &rect) override
 recommended overrides from QLayout More...
 
QSize sizeHint () const override
 recommended overrides from QLayout More...
 
bool isLocationValid (int location) const
 Returns true if the location points to a valid reachable location. More...
 
void split (int location, Qt::Orientation direction, double splitFraction)
 Adds a splitter item. More...
 
void splitAny (int location, double splitFraction)
 Adds a splitter item. More...
 
void splitVertical (int location, double splitFraction)
 Adds a splitter item. More...
 
void splitHorizontal (int location, double splitFraction)
 Adds a splitter item. More...
 
void maximize (int location)
 Maximize any cell location. More...
 

Detailed Description

QLayout specialization that supports a hierarchical layout.

pqHierarchicalGridLayout supports a layout where the widgets added to the layout can be treated as laid out in a binary tree with each non-leaf node splitting the viewport horizontally or vertically.

If one adds widgets to the layout using QLayout API e.g. addWidget then the layout will automatically build the binary tree by adding splits in the layout as needed.

Another way to explicitly provide an arrangement of widgets is to use rearrange to add/remove widgets from the layout and place them in particular fashion.

If pqHierarchicalGridLayout is added to a pqHierarchicalGridWidget then it is possible to allow the user to interactively resize individual widgets.

Note
Caveat

pqHierarchicalGridLayout currently does not support adding non QWidget items to the layout e.g. another QLayout or QSpacerItem etc. Support for these can be added in future when needed.

Definition at line 38 of file pqHierarchicalGridLayout.h.

Constructor & Destructor Documentation

◆ pqHierarchicalGridLayout()

pqHierarchicalGridLayout::pqHierarchicalGridLayout ( QWidget *  parent = nullptr)

◆ ~pqHierarchicalGridLayout()

pqHierarchicalGridLayout::~pqHierarchicalGridLayout ( )
override

Member Function Documentation

◆ addItem()

void pqHierarchicalGridLayout::addItem ( QLayoutItem *  item)
override

pure virtual methods from QLayout

◆ itemAt()

QLayoutItem* pqHierarchicalGridLayout::itemAt ( int  index) const
override

pure virtual methods from QLayout

◆ takeAt()

QLayoutItem* pqHierarchicalGridLayout::takeAt ( int  index)
override

pure virtual methods from QLayout

◆ count()

int pqHierarchicalGridLayout::count ( ) const
override

pure virtual methods from QLayout

◆ minimumSize()

QSize pqHierarchicalGridLayout::minimumSize ( ) const
override

recommended overrides from QLayout

◆ setGeometry()

void pqHierarchicalGridLayout::setGeometry ( const QRect &  rect)
override

recommended overrides from QLayout

◆ sizeHint()

QSize pqHierarchicalGridLayout::sizeHint ( ) const
override

recommended overrides from QLayout

◆ isLocationValid()

bool pqHierarchicalGridLayout::isLocationValid ( int  location) const

Returns true if the location points to a valid reachable location.

◆ split()

void pqHierarchicalGridLayout::split ( int  location,
Qt::Orientation  direction,
double  splitFraction 
)

Adds a splitter item.

location specified must be valid and reachable.

◆ splitAny()

void pqHierarchicalGridLayout::splitAny ( int  location,
double  splitFraction 
)

Adds a splitter item.

location specified must be valid and reachable.

◆ splitVertical()

void pqHierarchicalGridLayout::splitVertical ( int  location,
double  splitFraction 
)
inline

Adds a splitter item.

location specified must be valid and reachable.

Definition at line 79 of file pqHierarchicalGridLayout.h.

◆ splitHorizontal()

void pqHierarchicalGridLayout::splitHorizontal ( int  location,
double  splitFraction 
)
inline

Adds a splitter item.

location specified must be valid and reachable.

Definition at line 83 of file pqHierarchicalGridLayout.h.

◆ setSplitFraction()

void pqHierarchicalGridLayout::setSplitFraction ( int  location,
double  splitFraction 
)

Specify the split fraction for a location.

location must be valid and reachable.

◆ maximize()

void pqHierarchicalGridLayout::maximize ( int  location)

Maximize any cell location.

Set to 0 to return to default un-maximized state. Invalid location i.e. negative or referring to a non-existent or unreachable cell will be ignored with a warning message.

◆ rearrange()

QVector<QWidget*> pqHierarchicalGridLayout::rearrange ( const QVector< Item > &  layout)

API to rearrange the widgets in this layout.

The argument is simply a sequential representation for a binary tree were for a split node at index i, the first child node is at index 2*i + 1 and the second child node is at index 2*i + 2.

Any widgets previously added to the layout no longer present in the arrangement are removed from the layout and returned.

Any widgets not already present in the layout are added to the layout using addWidget.


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