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... | |
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.
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.
pqHierarchicalGridLayout::pqHierarchicalGridLayout | ( | QWidget * | parent = nullptr | ) |
|
override |
|
override |
pure virtual methods from QLayout
|
override |
pure virtual methods from QLayout
|
override |
pure virtual methods from QLayout
|
override |
pure virtual methods from QLayout
|
override |
recommended overrides from QLayout
|
override |
recommended overrides from QLayout
|
override |
recommended overrides from QLayout
bool pqHierarchicalGridLayout::isLocationValid | ( | int | location | ) | const |
Returns true if the location points to a valid reachable location.
void pqHierarchicalGridLayout::split | ( | int | location, |
Qt::Orientation | direction, | ||
double | splitFraction | ||
) |
Adds a splitter item.
location
specified must be valid and reachable.
Adds a splitter item.
location
specified must be valid and reachable.
Adds a splitter item.
location
specified must be valid and reachable.
Definition at line 79 of file pqHierarchicalGridLayout.h.
Adds a splitter item.
location
specified must be valid and reachable.
Definition at line 83 of file pqHierarchicalGridLayout.h.
Specify the split fraction for a location.
location
must be valid and reachable.
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.
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
.