terminalgui  0.1.0
Widgets for your terminal, powered by Qt! Create textual GUI (TUI) in your console easily.
Public Member Functions | List of all members
Tg::GridLayout Class Reference

Arranges children of parent() Widget in a grid. More...

#include <tggridlayout.h>

Inheritance diagram for Tg::GridLayout:
Inheritance graph
[legend]
Collaboration diagram for Tg::GridLayout:
Collaboration graph
[legend]

Public Member Functions

void doLayout () override
 Lays out children of Widget (parent). More...
 
int columnCount () const
 Returns the maximal number of columns this grid will draw. More...
 
void setColumnCount (const int number)
 Sets the maximal number of columns which this grid will draw.
 
- Public Member Functions inherited from Tg::Layout
Type type () const
 Returns the Type of this Layout.
 
Widgetparent () const
 Returns the parent Widget - on which Layout is working to resize and position it's children. More...
 
void setParent (Widget *parent)
 Sets the parent Widget. More...
 
SizeOvershoot overshoot () const
 Read this after calling doLayout() to check if all child widgets fit nicely onto parent.
 

Additional Inherited Members

- Public Types inherited from Tg::Layout
enum  Type {
  Type::None, Type::ChildFillsParent, Type::Column, Type::Row,
  Type::Grid
}
 Type of a Layout. More...
 
- Protected Member Functions inherited from Tg::Layout
 Layout (const Type type)
 Constructor used by subclasses to set Layout type they implement.
 
- Protected Attributes inherited from Tg::Layout
SizeOvershoot _overshoot = Overshoot::None
 Indicates whether children of Widget cannot fit the Widget, and in which direction they fail to fit.
 
Widget_parent = nullptr
 Parent Widget. More...
 
const Type _type = Type::None
 Type of a Layout. More...
 

Detailed Description

Arranges children of parent() Widget in a grid.

By defaylt, the grid will contain 2 columns - this can be changed by calling setColumnCount().

Maximum number of rows cannot be set - it depends on columnCount() and the number of children to lay out.

Member Function Documentation

◆ columnCount()

int Tg::GridLayout::columnCount ( ) const

Returns the maximal number of columns this grid will draw.

If Widgets do not fit, extra ones will be drawn in next row(s).

◆ doLayout()

void Tg::GridLayout::doLayout ( )
overridevirtual

Lays out children of Widget (parent).

It stretches first child to fill the whole widget.

Reimplemented from Tg::Layout.


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