Envision
A visual programming IDE for object-oriented languages
|
This class allows the arrangement of elements in a grid. More...
Public Member Functions | |
GridLayoutFormElement () | |
GridLayoutFormElement (const GridLayoutFormElement &other) | |
virtual | ~GridLayoutFormElement () |
virtual GridLayoutFormElement * | clone () const override |
virtual void | computeSize (Item *item, int availableWidth, int availableHeight) override |
Sets if the element has a cursor if it is empty to cursorWhenEmpty. More... | |
QPoint | focusedElement2DIndex (Item *item) const |
Returns the 2D index of the focused element for the specified item. More... | |
int | focusedElementIndex (Item *item) const |
Returns the index of the focused element for the specified item. More... | |
const Visualization::Item * | itemAt (DeclarativeItemBase *item, int index) const |
Asserts that this is a linear grid and returns the item at index. More... | |
int | length (Item *item) const |
Asserts that this is a linear grid and returns the length. More... | |
GridLayoutFormElement & | operator= (const GridLayoutFormElement &)=delete |
GridLayoutFormElement * | put (int column, int row, FormElement *element) |
Puts the element at column and row in the grid. More... | |
virtual QList< ItemRegion > | regions (DeclarativeItemBase *item, int parentX, int parentY) override |
GridLayoutFormElement * | setCellAlignment (LayoutStyle::Alignment horizontalAlignment, LayoutStyle::Alignment verticalAlignment) |
Sets the horizontal and vertical alignment to horizontalAlignment and verticalAlignment respectively for the cell where the last element was added. More... | |
GridLayoutFormElement * | setCellHorizontalAlignment (LayoutStyle::Alignment horizontalAlignment) |
Sets the horizontal alignment to horizontalAlignment for the cell where the last element was added. More... | |
GridLayoutFormElement * | setCellSpanning (int columnSpan, int rowSpan) |
Set the cell spanning of the cell where the last element was added. More... | |
GridLayoutFormElement * | setCellVerticalAlignment (LayoutStyle::Alignment verticalAlignment) |
Sets the vertical alignment to verticalAlignment for the cell where the last element was added. More... | |
GridLayoutFormElement * | setColumnHorizontalAlignment (int column, LayoutStyle::Alignment horizontalAlignment) |
Sets the horizontal alignment to horizontalAlignment for all the cells in the specified column. More... | |
GridLayoutFormElement * | setColumnStretchFactor (int column, float stretchFactor) |
Sets the stretch factor of this column to stretchFactor. More... | |
GridLayoutFormElement * | setColumnStretchFactors (float stretchFactor) |
Sets the stretch factor of all columns to stretchFactor. More... | |
GridLayoutFormElement * | setHorizontalAlignment (LayoutStyle::Alignment horizontalAlignment) |
Sets the horizontal alignment to horizontalAlignment for all the cells in the grid. More... | |
GridLayoutFormElement * | setHorizontalSpacing (int spaceBetweenColumns) |
Sets the horizontal spacing to spaceBetweenColumns. More... | |
GridLayoutFormElement * | setRowStretchFactor (int row, float stretchFactor) |
Sets the stretch factor of this row to stretchFactor. More... | |
GridLayoutFormElement * | setRowStretchFactors (float stretchFactor) |
Sets the stretch factor of all rows to stretchFactor. More... | |
GridLayoutFormElement * | setRowVerticalAlignment (int row, LayoutStyle::Alignment verticalAlignment) |
Sets the vertical alignment to verticalAlignment for all the cells in the specified row. More... | |
GridLayoutFormElement * | setSpacing (int spaceBetweenColumns, int spaceBetweenRows) |
Sets the horizontal and the vertical spacing to spaceBetweenColumns and spaceBetweenRows respectively. More... | |
GridLayoutFormElement * | setSpacing (int spacing) |
Sets the horizontal and the vertical spacing to the same value. More... | |
GridLayoutFormElement * | setStretchFactors (float stretchFactor) |
Sets the stretch factor of all columns and rows to stretchFactor. More... | |
GridLayoutFormElement * | setVerticalAlignment (LayoutStyle::Alignment verticalAlignment) |
Sets the vertical alignment to verticalAlignment for all the cells in the grid. More... | |
GridLayoutFormElement * | setVerticalSpacing (int spaceBetweenRows) |
Sets the vertical spacing to spaceBetweenRows. More... | |
virtual bool | sizeDependsOnParent (const Item *item) const override |
Public Member Functions inherited from Visualization::SuperLayoutElement< GridLayoutFormElement, LayoutFormElement > | |
GridLayoutFormElement * | setHasCursorWhenEmpty (std::function< bool(Item *item)> hasCursorWhenEmptyGetter) |
Sets a getter (cursorWhenEmptyGetter) for checking if the element should have cursors when empty dynamically while rendering. More... | |
GridLayoutFormElement * | setNoBoundaryCursors (std::function< bool(Item *item)> noBoundaryCursorsGetter) |
Sets a getter (noBoundaryCursorsGetter) for checking if the element should not have any boundary cursors dynamically while rendering. More... | |
GridLayoutFormElement * | setNoInnerCursors (std::function< bool(Item *item)> noInnerCursorsGetter) |
Sets a getter (noInnerCursorsGetter) for checking if the element should not have any inner cursors dynamically while rendering. More... | |
GridLayoutFormElement * | setNotLocationEquivalentCursors (std::function< bool(Item *item)> notLocationEquivalentCursorsGetter) |
Sets a getter (notLocationEquivalentGetter) for checking if the element's cursors are not location equivalent dynamically while rendering. More... | |
Public Member Functions inherited from Visualization::SuperFormElement< NewFormElement, BaseFormElement > | |
NewFormElement * | setBottomMargin (int bottom) |
Sets the bottom margin of this form element. More... | |
NewFormElement * | setLeftMargin (int left) |
Sets the left margin of this form element. More... | |
NewFormElement * | setMargins (int left, int top, int right, int bottom) |
Sets the left, top, right and bottom margins to the respective values. More... | |
NewFormElement * | setMargins (int margin) |
Sets all the margins of this form element to the value specified as margin. More... | |
NewFormElement * | setRightMargin (int right) |
Sets the right margin of this form element. More... | |
NewFormElement * | setTopMargin (int top) |
Sets the top margin of this form element. More... | |
Private Member Functions | |
void | adjustSize (int containColumn, int containRow) |
Adjusts the dimensions of the grid, such that it contains the column with index containColumn and the row with index containColumn. More... | |
void | computeOverallStretchFactors () |
Recomputes and caches the sum of the column stretch factors and the row stretch factors respectively. More... | |
Private Attributes | |
QVector< QVector< LayoutStyle::Alignment > > | cellHorizontalAlignmentGrid_ {} |
QVector< QVector< LayoutStyle::Alignment > > | cellVerticalAlignmentGrid_ {} |
QVector< float > | columnStretchFactors_ {} |
QVector< LayoutStyle::Alignment > | defaultColumnHorizontalAlignments_ {} |
float | defaultColumnStretchFactor_ {} |
LayoutStyle::Alignment | defaultHorizontalAlignment_ {LayoutStyle::Alignment::Left} |
float | defaultRowStretchFactor_ {} |
QVector< LayoutStyle::Alignment > | defaultRowVerticalAlignments_ {} |
LayoutStyle::Alignment | defaultVerticalAlignment_ {LayoutStyle::Alignment::Top} |
QVector< QVector< FormElement * > > | elementGrid_ {} |
QPair< int, int > | lastCell_ {QPair<int, int>(0, 0)} |
int | numColumns_ {1} |
int | numRows_ {1} |
float | overallColumnStretchFactor_ {} |
float | overallRowStretchFactor_ {} |
QVector< float > | rowStretchFactors_ {} |
int | spaceBetweenColumns_ {} |
int | spaceBetweenRows_ {} |
QVector< QVector< QPair< int, int > > > | spanGrid_ {} |
This class allows the arrangement of elements in a grid.
During its definition the grid is automatically resized to contain all the specified column and row indices.
The grid supports
Visualization::GridLayoutFormElement::GridLayoutFormElement | ( | ) |
Visualization::GridLayoutFormElement::GridLayoutFormElement | ( | const GridLayoutFormElement & | other | ) |
|
virtual |
|
private |
Adjusts the dimensions of the grid, such that it contains the column with index containColumn and the row with index containColumn.
The grid dimensions can only grow.
|
overridevirtual |
|
private |
Recomputes and caches the sum of the column stretch factors and the row stretch factors respectively.
|
overridevirtual |
Sets if the element has a cursor if it is empty to cursorWhenEmpty.
Is false by default. Also see SequentialLayoutStyle::hasCursorWhenEmpty().
QPoint Visualization::GridLayoutFormElement::focusedElement2DIndex | ( | Item * | item | ) | const |
Returns the 2D index of the focused element for the specified item.
If no element is focused, returns -1 for both coordinates.
int Visualization::GridLayoutFormElement::focusedElementIndex | ( | Item * | item | ) | const |
Returns the index of the focused element for the specified item.
If no element is focused, returns -1. This method is very similar to the focsedElementIndex of SequentialLayout (layouts folder).
const Visualization::Item * Visualization::GridLayoutFormElement::itemAt | ( | Visualization::DeclarativeItemBase * | item, |
int | index | ||
) | const |
Asserts that this is a linear grid and returns the item at index.
If there is not an item but some compound FormElement at that place, that is also an assertion violation!
int Visualization::GridLayoutFormElement::length | ( | Visualization::Item * | item | ) | const |
Asserts that this is a linear grid and returns the length.
|
delete |
GridLayoutFormElement * Visualization::GridLayoutFormElement::put | ( | int | column, |
int | row, | ||
FormElement * | element | ||
) |
Puts the element at column and row in the grid.
If the element is already used elsewhere (is a form root, or has a parent) it is cloned and that clone is put in the grid instead.
Returns a pointer to this GridLayoutElement.
|
overridevirtual |
|
inline |
Sets the horizontal and vertical alignment to horizontalAlignment and verticalAlignment respectively for the cell where the last element was added.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the horizontal alignment to horizontalAlignment for the cell where the last element was added.
Returns a pointer to this GridLayoutElement.
|
inline |
Set the cell spanning of the cell where the last element was added.
This means columnSpan x rowSpan cells will be merged into a new cell, of which the column and row of the last added cell is the top left corner. A default cell has a columnSpan and rowSpan of one each. Returns a pointer to this GridLayoutElement.
|
inline |
Sets the vertical alignment to verticalAlignment for the cell where the last element was added.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the horizontal alignment to horizontalAlignment for all the cells in the specified column.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the stretch factor of this column to stretchFactor.
The stretch factor determines, how much of the additionally available space this column gets if there is any. By default this is 0, meaning the column does not stretch. If the stretch factor is bigger than zero, the column gets a portion of additional space computed by (stretchFactor) / (sum of all column stretch factors).
|
inline |
Sets the stretch factor of all columns to stretchFactor.
The stretch factor determines, how much of the additionally available space each column gets if there is any. By default this is 0, meaning the column does not stretch. If the stretch factor is bigger than zero, the column gets a portion of additional space computed by (stretchFactor) / (sum of all column stretch factors).
|
inline |
Sets the horizontal alignment to horizontalAlignment for all the cells in the grid.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the horizontal spacing to spaceBetweenColumns.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the stretch factor of this row to stretchFactor.
The stretch factor determines, how much of the additionally available space this row gets if there is any. By default this is 0, meaning the row does not stretch. If the stretch factor is bigger than zero, the row gets a portion of additional space computed by (stretchFactor) / (sum of all row stretch factors).
|
inline |
Sets the stretch factor of all rows to stretchFactor.
The stretch factor determines, how much of the additionally available space each row gets if there is any. By default this is 0, meaning the row does not stretch. If the stretch factor is bigger than zero, the row gets a portion of additional space computed by (stretchFactor) / (sum of all row stretch factors).
|
inline |
Sets the vertical alignment to verticalAlignment for all the cells in the specified row.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the horizontal and the vertical spacing to spaceBetweenColumns and spaceBetweenRows respectively.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the horizontal and the vertical spacing to the same value.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the stretch factor of all columns and rows to stretchFactor.
The stretch factor determines, how much of the additionally available space each column/row gets if there is any. By default this is 0, meaning the column/row does not stretch. If the stretch factor is bigger than zero, the column/row gets a portion of additional space computed by (stretchFactor) / (sum of all column/row stretch factors).
|
inline |
Sets the vertical alignment to verticalAlignment for all the cells in the grid.
Returns a pointer to this GridLayoutElement.
|
inline |
Sets the vertical spacing to spaceBetweenRows.
Returns a pointer to this GridLayoutElement.
|
overridevirtual |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |