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

Base class for all widgets in a Terminal Gui application. More...

#include <tgwidget.h>

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

Public Slots

void setPosition (const QPoint &position)
 Moves Widget to a new position. More...
 
void setSize (const QSize &size)
 Resizes Widget to a new size.
 
void setBackgroundColor (const Tg::Color &color)
 Changes background color.
 
void setBackgroundCharacter (const QChar &character)
 Changes character drawn in the empty space of this Widget.
 
void setTextColor (const Tg::Color &color)
 Changes text color.
 
void setBorderTextColor (const Tg::Color &color)
 Changes border text color.
 
void setBorderBackgroundColor (const Tg::Color &color)
 Changes border background color.
 
void setVisible (const bool visible)
 Makes Widget visible (or not). More...
 
void show ()
 Makes Widget visible. More...
 
void hide ()
 Makes Widget hidden. More...
 
void setBorderVisible (const bool visible)
 Makes Widget's border visible (or not).
 
void setZ (const int z)
 
WidgetList childrenWidgets () const
 Returns all children of this Widget which can be cast to Widget.
 

Signals

void needsRedraw (const RedrawType type, const Widget *widget) const
 Indicates that widget (usually this) needs to be redrawn using redraw type.
 
void positionChanged (const QPoint &position) const
 Emitted when Widget's position changes.
 
void sizeChanged (const QSize &size) const
 Emitted when Widget's size is changed.
 
void backgroundColorChanged (const Tg::Color &color) const
 Indicates that Widget's background color has changed.
 
void backgroundCharacterChanged (const QChar &character) const
 Indicates that Widget's background character has changed.
 
void textColorChanged (const Tg::Color &color) const
 Indicates that Widget's text color has changed.
 
void borderTextColorChanged (const Tg::Color &color) const
 Indicates that Widget's border text color has changed.
 
void borderBackgroundColorChanged (const Tg::Color &color) const
 Indicates that Widget's border background color has changed.
 
void visibleChanged (const bool visible) const
 Indicates that Widget is shown or hidden (depening on visible).
 
void borderVisibleChanged (const bool visible) const
 Indicates that Widget's border is now visible (or not).
 
void acceptsFocusChanged (const bool accepts) const
 Indicates that Widget now accepts focus (or not).
 
void hasFocusChanged (const bool hasFocus) const
 Indicates that Widget now hasFocus (or not).
 
void moveFocusToPreviousWidget () const
 Indicates that active focus should be moved to the previous Widget ready to receive it.
 
void moveFocusToNextWidget () const
 Indicates that active focus should be moved to the next Widget ready to receive it.
 
void propagatesStyleChanged (const bool propagates) const
 Indicates that Widget either stopped or resumed (propagates) propagating its Style object to its children.
 
void styleChanged () const
 Emitted when Widget's Style object is changed.
 
void layoutOvershootChanged (const SizeOvershoot overshoot) const
 Emitted when layout overshoot has changed.
 
void widgetOvershootChanged (const SizeOvershoot overshoot) const
 Emitted when Widget overshoot has changed.
 
void childAdded (Widget *child) const
 Emitted when a child Widget has been added.
 
void childRemoved () const
 Emitted when a child Widget has been removed.
 
void zChanged (const int z) const
 Emitted when z value changes.
 

Public Member Functions

 Widget (Widget *parent)
 Constructs Widget as a child of parent. More...
 
 Widget (Screen *screen)
 Constructs a top-level Widget on a given screen. More...
 
 ~Widget ()
 Deregisters the Widget from parent Screen, then destroys the Widget object.
 
QPoint position () const
 Returns current position of the Widget (relative). More...
 
QSize size () const
 Returns current size of the Widget. More...
 
QRect boundingRectangle () const
 Returns the rectangle constructed from position() and size(). More...
 
QRect globalBoundingRectangle () const
 Returns the rectangle contructed from position() (mapped to global coordinates using mapToGlobal()) and size(). More...
 
QRect contentsRectangle () const
 Returns the rectangle which holds Widget interior. More...
 
Tg::Color backgroundColor () const
 Returns current background color - either taken from Style or value set using setBackgroundColor(). More...
 
QChar backgroundCharacter () const
 Returns character drawn on empty space in this Widget.
 
Tg::Color textColor () const
 Returns current text color - either taken from Style or value set using setTextColor(). More...
 
Tg::Color borderTextColor () const
 Returns current border text color - either taken from Style or value set using setBorderTextColor(). More...
 
Tg::Color borderBackgroundColor () const
 Returns current border background color - either taken from Style or value set using setBorderBackgroundColor(). More...
 
bool visible () const
 Returns true when Widget is visible.
 
bool borderVisible () const
 Returns true when Widget's border is visible. More...
 
bool acceptsFocus () const
 Returns true when Widget is set to accept focus (keyboard or mouse). More...
 
bool hasFocus () const
 Returns true when Widget actively holds focus (is receiving keyboard events). More...
 
void setAcceptsFocus (const bool accept)
 When accept is true, this Widget will receive keyboard events from Screen instance - but only when it actively holds focus (see hasFocus()). More...
 
Screenscreen () const
 Returns the Screen on which this Widget is being drawn.
 
WidgetparentWidget () const
 Returns the parent Widget. More...
 
WidgettopLevelParentWidget () const
 Returns top-level parent of current Widget. More...
 
bool isTopLevel () const
 Returns true if this Widget is top-level. More...
 
bool isBorder (const QPoint &pixel) const
 Returns true when pixel lies within the border of the Widget. More...
 
bool verticalArrowsMoveFocus () const
 Returns true if this Widget ignores up and down arrows on keyboard. More...
 
QPoint mapFromGlobal (const QPoint &position) const
 Returns position mapped from global coordinates into local one (coordinates within the Widget, where (0,0) is top-left corner).
 
QPoint mapToGlobal (const QPoint &position) const
 Returns position mapped from local coordinates into global ones (coordinates within parent Screen).
 
QPoint mapToChild (const WidgetPointer &child, const QPoint &position) const
 Returns position mapped into child coordinate system.
 
bool propagatesStyle () const
 Returns true if this Widget automatically applies its Style to all children Widgets. More...
 
void setStyle (const StylePointer &style, const bool propagate=true)
 Sets a new Style on this Widget. More...
 
Layout::Type layoutType () const
 Returns Layout type. More...
 
void setLayoutType (const Layout::Type type)
 Sets the way this Widget places, paints and treats children widgets to type.
 
SizeOvershoot layoutOvershoot () const
 Returns current overshoot of layout inside this Widget. More...
 
SizeOvershoot widgetOvershoot () const
 Returns current overshoot of contents of this Widget. More...
 
int z () const
 Returns the z value - position of this Widget on z order stack.
 

Protected Slots

void scheduleFullRedraw () const
 Instructs Screen that full redraw of entire Screen area should be performed. More...
 
void schedulePartialRedraw () const
 Instructs Screen to redraw this Widget only, at its current position. More...
 
void schedulePreviousPositionRedraw () const
 Instructs Screen to redraw the area previously occupied by this Widget. More...
 

Protected Member Functions

virtual void init ()
 Initializes Widget and it's connections. More...
 
void setHasFocus (const bool active)
 Sets this Widget to hold active focus (or not). More...
 
virtual void consumeKeyboardBuffer (const QString &keyboardBuffer)
 Called when Widget accepts focus and keyboardBuffer is not empty. More...
 
virtual QString drawBorderPixel (const QPoint &pixel) const
 Returns ANSI-encoded string, used by Screen to draw the pixel. More...
 
virtual QString drawPixel (const QPoint &pixel) const
 Returns ANSI-encoded string, used by Screen to draw the pixel. More...
 
QPoint previousGlobalPosition () const
 Returns Widget's last position (before it was moved), in global coordinates. More...
 
QSize previousSize () const
 Returns Widget's previous size (before it was resized). More...
 
QRect globalPreviousBoundingRectangle () const
 Returns globalBoundingRectangle() recorded last time when widget was moved or its size has been changed.
 
int effectiveBorderWidth () const
 If borders are visible, it returns border width. More...
 
void setVerticalArrowsMoveFocus (const bool enable)
 If enable is true, clicking up arrow or down arrow on keyboard will be intercepted by parent Screen and used to switch focus to previous or next Widget. More...
 
void setPropagatesStyle (const bool propagate)
 When propagate is true, this Widget will set its style() object on its children whenever it changes. More...
 
void propagateStyleToChild (Widget *child) const
 Propagates style() to child. More...
 
StylePointer style () const
 Returns the pointer to Style object used to draw this Widget. More...
 
void setWidgetOvershoot (const SizeOvershoot overshoot)
 Sets current overshoot of the contents of this Widget.
 
void setupPressTimer (QTimer *timer) const
 Sets timer object which controls how long pressed elements (buttons, scroll bar arrows, etc.) look different (pressed). More...
 
void doLayout ()
 Forces Widget to lay out its children according to layoutType(). More...
 

Properties

QPoint position
 Position of Widget. More...
 
QSize size
 Size of the Widget. More...
 
int z
 Widget position on the z axis - this is used to control which Widgets should be displayed above and which below if they overlap.
 
Tg::Color backgroundColor
 Color of the background of Widget's interior (contentsRectangle()). More...
 
QChar backgroundCharacter
 This is the character which fills the empty background. More...
 
Tg::Color textColor
 Color of the characters ("foreground color") printed inside of the Widget (see contentsRectangle()). More...
 
Tg::Color borderTextColor
 Color of the characters ("foreground color") printed on the borders of the Widget (see boundingRectangle()). More...
 
Tg::Color borderBackgroundColor
 Color of the background of Widget's border (see boundingRectangle()). More...
 
bool visible
 A visible Widget is visible. More...
 
bool borderVisible
 Controls whether border is drawn. More...
 
bool acceptsFocus
 When true, Widget will receive keyboard signals (Screen will call consumeKeyboardBuffer()) when its turn comes.
 
bool hasFocus
 Returns true when Widget is currently actively listening to keyboard signals. More...
 
bool propagatesStyle
 If true, Widget will set its Style object on its children widgets. More...
 

Friends

class Screen
 
class ScrollArea
 

Detailed Description

Base class for all widgets in a Terminal Gui application.

Plain Widget, when drawn on screen, will draw its border and an empty interior. If it is a child of another Widget, or when borderVisible() is false, it only draw empty contents.

Subclassing

Widget subclasses reimplement its drawPixel() method to draw actual contents. It is also very important to reimplement init() method and put initialization code there, plus all signal and slot connections necessary to update the Screen when Widget changes.

Every Widget subclass should contain at least 2 constructors:

If a subclass needs keyboard interaction, it should call setAcceptsFocus() in its init() override, and implement consumeKeyboardBuffer() with logic responding to key presses. See Key namespace for helper constants which make detection of particular clicks easier.

Differences from Qt Widgets

Unlike QWidget which relies on a separate class to do layouting (QLayout), Widget can lay its children automatically. This can be controlled using setLayoutType().

Styling

Widget (and all its subclasses) can be styled in several ways. By default, Widget inherits Style from its parent (or Screen class) unless propagatesStyle() returns false. A custom Style can be set (either for this Widget only, or also for all its children) using setStyle(). Alternatively, each individual style-related property can be overriden using various setters (for example: setBackgroundColor(), setTextColor() etc.). These setters always work only for this single Widget and have no effect on its children.

Since
0.1.0

Constructor & Destructor Documentation

◆ Widget() [1/2]

Tg::Widget::Widget ( Widget parent)
explicit

Constructs Widget as a child of parent.

By default, a child Widget does not have a border.

See also
setBorderVisible

◆ Widget() [2/2]

Tg::Widget::Widget ( Tg::Screen screen)
explicit

Constructs a top-level Widget on a given screen.

A top-level does have a border by default.

There can be many top-level Widgets registered under the same Screen.

See also
setBorderVisible

Member Function Documentation

◆ acceptsFocus()

bool Tg::Widget::acceptsFocus ( ) const

Returns true when Widget is set to accept focus (keyboard or mouse).

See also
setAcceptsFocus, hasFocus

◆ backgroundColor()

Tg::Color Tg::Widget::backgroundColor ( ) const

Returns current background color - either taken from Style or value set using setBackgroundColor().

See also
style, setBackgroundColor

◆ borderBackgroundColor()

Tg::Color Tg::Widget::borderBackgroundColor ( ) const

Returns current border background color - either taken from Style or value set using setBorderBackgroundColor().

See also
style, setBorderBackgroundColor

◆ borderTextColor()

Tg::Color Tg::Widget::borderTextColor ( ) const

Returns current border text color - either taken from Style or value set using setBorderTextColor().

The "text" on Widget border are the lines (characters) used to draw the border. They are defined in BorderStyle.

See also
style, setBorderTextColor

◆ borderVisible()

bool Tg::Widget::borderVisible ( ) const

Returns true when Widget's border is visible.

A top-level Widget has border visible by default. It can be overriden using setBorderVisible().

See also
setBorderVisible

◆ boundingRectangle()

QRect Tg::Widget::boundingRectangle ( ) const

Returns the rectangle constructed from position() and size().

This rectangle includes Widget border and contents.

◆ consumeKeyboardBuffer()

void Tg::Widget::consumeKeyboardBuffer ( const QString &  keyboardBuffer)
protectedvirtual

Called when Widget accepts focus and keyboardBuffer is not empty.

See also
acceptsFocus

Reimplemented in Tg::ScrollBar, Tg::RadioButton, Tg::Button, Tg::ListView, Tg::LineEdit, Tg::ScrollArea, and Tg::CheckBox.

◆ contentsRectangle()

QRect Tg::Widget::contentsRectangle ( ) const

Returns the rectangle which holds Widget interior.

It is similar to boundingRectangle() but with Widget border removed.

◆ doLayout()

void Tg::Widget::doLayout ( )
protected

Forces Widget to lay out its children according to layoutType().

See also
layoutType

◆ drawBorderPixel()

QString Tg::Widget::drawBorderPixel ( const QPoint &  pixel) const
protectedvirtual

Returns ANSI-encoded string, used by Screen to draw the pixel.

"Draws" the border at position pixel. The pixel is expected to be in local coordinate system (where (0,0) denotes the top-left corner of the border).

See also
drawPixel, effectiveBorderWidth

◆ drawPixel()

QString Tg::Widget::drawPixel ( const QPoint &  pixel) const
protectedvirtual

Returns ANSI-encoded string, used by Screen to draw the pixel.

"Draws" the internal contents of the Widget. Default implementation draws the border (see drawBorderPixel()), any child Widgets (if present), in accordance with layoutType(). If there is any empty space left, it is filled with backgroundCharacter().

See also
drawBorderPixel, layoutType, setLayoutType, backgroundCharacter, children

Reimplemented in Tg::ScrollBar, Tg::ScrollArea, and Tg::Label.

◆ effectiveBorderWidth()

int Tg::Widget::effectiveBorderWidth ( ) const
protected

If borders are visible, it returns border width.

Otherwise, it returns 0.

Note
Currently, setting custom border width is not supported, so this method only return 0 (zero) or 1.
See also
borderVisible

◆ globalBoundingRectangle()

QRect Tg::Widget::globalBoundingRectangle ( ) const

Returns the rectangle contructed from position() (mapped to global coordinates using mapToGlobal()) and size().

This rectangle includes Widget border and contents.

◆ hasFocus()

bool Tg::Widget::hasFocus ( ) const

Returns true when Widget actively holds focus (is receiving keyboard events).

See also
setHasFocus, acceptsFocus

◆ hide

void Tg::Widget::hide ( )
slot

Makes Widget hidden.

See also
setVisible, show

◆ init()

void Tg::Widget::init ( )
protectedvirtual

Initializes Widget and it's connections.

All subclasses should call init() of its parent class. If a subclass has any properties or signals which affect the visual look of the Widget, it should reimplement init() and connect such signal to schedulePartialRedraw() slot.

See also
schedulePartialRedraw

Reimplemented in Tg::ScrollBar, Tg::RadioButton, Tg::Button, Tg::ListView, Tg::LineEdit, Tg::ScrollArea, Tg::Label, and Tg::CheckBox.

◆ isBorder()

bool Tg::Widget::isBorder ( const QPoint &  pixel) const

Returns true when pixel lies within the border of the Widget.

If border is not visible, it will always return false.

See also
borderVisible

◆ isTopLevel()

bool Tg::Widget::isTopLevel ( ) const

Returns true if this Widget is top-level.

This means that parentWidget() returns nullptr.

◆ layoutOvershoot()

Tg::SizeOvershoot Tg::Widget::layoutOvershoot ( ) const

Returns current overshoot of layout inside this Widget.

If Widgets within the Layout do not fit the Widget, SizeOvershoot will indicate whether Widget is too small horizontally or vertically.

Visually, it is represented by drawing red arrows on Widget border (by default - see BorderStyle::horizontalOvershoot, BorderStyle::verticalOvershoot, BorderStyle::overshootTextColor and BorderStyle::overshootBackgroundColor).

◆ layoutType()

Tg::Layout::Type Tg::Widget::layoutType ( ) const

Returns Layout type.

It specifies how Widget places, paints and treats children Widgets.

◆ parentWidget()

Tg::Widget * Tg::Widget::parentWidget ( ) const

Returns the parent Widget.

If returned pointer is a nullptr, it means this Widget is a top level Widget, usually drawn with border (unless setBorderVisible() has overriden the default behavior).

See also
setBorderVisible, topLevelParentWidget

◆ position()

QPoint Tg::Widget::position ( ) const

Returns current position of the Widget (relative).

See also
mapToGlobal, boundingRectangle, globalBoundingRectangle

◆ previousGlobalPosition()

QPoint Tg::Widget::previousGlobalPosition ( ) const
protected

Returns Widget's last position (before it was moved), in global coordinates.

If Widget has not been moved, it will return same location as position() mapped to global coordinate system.

See also
previousSize

◆ previousSize()

QSize Tg::Widget::previousSize ( ) const
protected

Returns Widget's previous size (before it was resized).

If Widget has not been resized, it will return same result as size().

See also
previousGlobalPosition

◆ propagatesStyle()

bool Tg::Widget::propagatesStyle ( ) const

Returns true if this Widget automatically applies its Style to all children Widgets.

This is true by default.

◆ propagateStyleToChild()

void Tg::Widget::propagateStyleToChild ( Widget child) const
protected

Propagates style() to child.

Both Widgets will use the same Style object.

◆ scheduleFullRedraw

void Tg::Widget::scheduleFullRedraw ( ) const
protectedslot

Instructs Screen that full redraw of entire Screen area should be performed.

Warning
Calling this method often can cause flicker!

◆ schedulePartialRedraw

void Tg::Widget::schedulePartialRedraw ( ) const
protectedslot

Instructs Screen to redraw this Widget only, at its current position.

See also
position, size

◆ schedulePreviousPositionRedraw

void Tg::Widget::schedulePreviousPositionRedraw ( ) const
protectedslot

Instructs Screen to redraw the area previously occupied by this Widget.

This is necessary to "clean up" the are of Screen where Widget used to be before it has been moved.

See also
previousGlobalPosition, previousSize

◆ setAcceptsFocus()

void Tg::Widget::setAcceptsFocus ( const bool  accept)

When accept is true, this Widget will receive keyboard events from Screen instance - but only when it actively holds focus (see hasFocus()).

In order to be able to "do something" with keyboard events, reimplement consumeKeyboardBuffer().

See also
hasFocus, acceptsFocus

◆ setHasFocus()

void Tg::Widget::setHasFocus ( const bool  active)
protected

Sets this Widget to hold active focus (or not).

This method is typically only called by Screen. Setting it manually may lead to side effects.

◆ setPosition

void Tg::Widget::setPosition ( const QPoint &  position)
slot

Moves Widget to a new position.

The position is relative to parent Widget, or to Screen if this Widget is top-level.

◆ setPropagatesStyle()

void Tg::Widget::setPropagatesStyle ( const bool  propagate)
protected

When propagate is true, this Widget will set its style() object on its children whenever it changes.

This means that Widget and all its children will use the same Style object and draw their UI in the same way.

Note
Each visual property can be locally (only for this Widget) overriden by setting it to a value other than default. For example, calling setTextColor(Color::Predefined::Red); will set the text color of this Widget (but not its children!) to red.

◆ setStyle()

void Tg::Widget::setStyle ( const StylePointer style,
const bool  propagate = true 
)

Sets a new Style on this Widget.

If propagate is true, this new Style pointer will also be set on all children (recursively).

◆ setupPressTimer()

void Tg::Widget::setupPressTimer ( QTimer *  timer) const
protected

Sets timer object which controls how long pressed elements (buttons, scroll bar arrows, etc.) look different (pressed).

Warning
This method does not take ownership of the timer
See also
Button, ScrollBar

◆ setVerticalArrowsMoveFocus()

void Tg::Widget::setVerticalArrowsMoveFocus ( const bool  enable)
protected

If enable is true, clicking up arrow or down arrow on keyboard will be intercepted by parent Screen and used to switch focus to previous or next Widget.

This Widget will not receive a call to consumeKeyboardBuffer().

See also
consumeKeyboardBuffer, hasFocus, acceptsFocus

◆ setVisible

void Tg::Widget::setVisible ( const bool  visible)
slot

Makes Widget visible (or not).

See also
show, hide

◆ show

void Tg::Widget::show ( )
slot

Makes Widget visible.

See also
setVisible, hide

◆ size()

QSize Tg::Widget::size ( ) const

Returns current size of the Widget.

See also
boundingRectangle

◆ style()

Tg::StylePointer Tg::Widget::style ( ) const
protected

Returns the pointer to Style object used to draw this Widget.

By default, same Style object is shared by all Widgets within a Screen.

See also
setPropagatesStyle, propagateStyleToChild

◆ textColor()

Tg::Color Tg::Widget::textColor ( ) const

Returns current text color - either taken from Style or value set using setTextColor().

See also
style, setTextColor

◆ topLevelParentWidget()

Tg::Widget * Tg::Widget::topLevelParentWidget ( ) const

Returns top-level parent of current Widget.

If current Widget is already top-level, it will return a pointer to itself.

This function will never return a nullptr.

See also
parentWidget, isTopLevel

◆ verticalArrowsMoveFocus()

bool Tg::Widget::verticalArrowsMoveFocus ( ) const

Returns true if this Widget ignores up and down arrows on keyboard.

Also returns true if Widget does not accept focus at all.

◆ widgetOvershoot()

Tg::SizeOvershoot Tg::Widget::widgetOvershoot ( ) const

Returns current overshoot of contents of this Widget.

It is very similar to layoutOvershoot() but overshoot is reported when Widget contents (not children Widgets arranged by a layout) fo not fit. For example, when a Label has text which is too long to fit.

See also
layoutOvershoot

Property Documentation

◆ backgroundCharacter

QChar Tg::Widget::backgroundCharacter
readwrite

This is the character which fills the empty background.

By default it is space, so no character is shown at all (only backgroundColor()).

Note
When this property is modified, it only affects this object. Other Widgets, including children, will still get baground character from propagated Style object.

◆ backgroundColor

Tg::Color Tg::Widget::backgroundColor
readwrite

Color of the background of Widget's interior (contentsRectangle()).

Note
If no color is set (or Color::Predefined::Invalid is set), a default color will be taken from Style object (see style()).
When this property is modified, it only affects this object. Other Widgets, including children, will still get their colors from propagated Style object.

◆ borderBackgroundColor

Tg::Color Tg::Widget::borderBackgroundColor
readwrite

Color of the background of Widget's border (see boundingRectangle()).

Note
If no color is set (or Color::Predefined::Invalid is set), a default color will be taken from Style object (see style()).
When this property is modified, it only affects this object. Other Widgets, including children, will still get their colors from propagated Style object.

◆ borderTextColor

Tg::Color Tg::Widget::borderTextColor
readwrite

Color of the characters ("foreground color") printed on the borders of the Widget (see boundingRectangle()).

Note
If no color is set (or Color::Predefined::Invalid is set), a default color will be taken from Style object (see style()).
When this property is modified, it only affects this object. Other Widgets, including children, will still get their colors from propagated Style object.

◆ borderVisible

bool Tg::Widget::borderVisible
readwrite

Controls whether border is drawn.

When border is visible, Widget contents are drawn inside of it (call contentsRectangle() to get the are inside of the borders).

When border is not visible, contents fill the whole boundingRectangle() (thus contentsRectangle() and boundingRectangle() return the same data).

See also
boundingRectangle, globalBoundingRectangle, globalPreviousBoundingRectangle, contentsRectangle, effectiveBorderWidth

◆ hasFocus

bool Tg::Widget::hasFocus
read

Returns true when Widget is currently actively listening to keyboard signals.

See also
acceptsFocus

◆ position

QPoint Tg::Widget::position
readwrite

Position of Widget.

Position is relative either to the Screen or to its parent Widget.

◆ propagatesStyle

bool Tg::Widget::propagatesStyle
read

If true, Widget will set its Style object on its children widgets.

If false, WIdget will keep its Style to itself (child widgets will inherit Style from Screen instead).

◆ size

QSize Tg::Widget::size
readwrite

Size of the Widget.

If the Widget is a child of another one, with layout set, the size will be modified automatically to fit the layout.

◆ textColor

Tg::Color Tg::Widget::textColor
readwrite

Color of the characters ("foreground color") printed inside of the Widget (see contentsRectangle()).

Note
If no color is set (or Color::Predefined::Invalid is set), a default color will be taken from Style object (see style()).
When this property is modified, it only affects this object. Other Widgets, including children, will still get their colors from propagated Style object.

◆ visible

bool Tg::Widget::visible
readwrite

A visible Widget is visible.

Right?


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