terminalgui  0.1.0
Widgets for your terminal, powered by Qt! Create textual GUI (TUI) in your console easily.
tgcheckbox.h
1 #pragma once
2 
3 #include <widgets/tgbutton.h>
4 
5 namespace Tg {
6 class CheckBox : public Button
7 {
8  Q_OBJECT
9 
10  Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged)
11 
12 public:
13  CheckBox(Widget *parent);
15  CheckBox(const QString &text = QString(), Widget *parent = nullptr);
16  CheckBox(const QString &text = QString(), Screen *screen = nullptr);
17 
18  Qt::CheckState checkState() const;
19 
20  static QString checkBoxText(const Qt::CheckState state,
21  const StylePointer &style);
22 
23 signals:
24  void checkStateChanged(const Qt::CheckState checkState) const;
25 
26 public slots:
27  void setCheckState(const Qt::CheckState checkState);
28  void toggleState();
29 
30 protected:
31  void init() override;
32  void consumeKeyboardBuffer(const QString &keyboardBuffer) override;
33  QString checkBoxText() const;
34 
35 private:
36  Qt::CheckState _checkState = Qt::CheckState::Unchecked;
37 };
38 }
Tg::Screen
Screen is the "canvas" on which widgets (subclasses of Widget) are drawn.
Definition: tgscreen.h:31
Tg::CheckBox::init
void init() override
Initializes Widget and it's connections.
Definition: tgcheckbox.cpp:66
Tg
All Terminal GUI classes (both core and widgets) are defined within the Tg namespace.
Definition: tgcolor.h:6
Tg::Widget
Base class for all widgets in a Terminal Gui application.
Definition: tgwidget.h:64
Tg::Widget::style
StylePointer style() const
Returns the pointer to Style object used to draw this Widget.
Definition: tgwidget.cpp:654
Tg::StylePointer
QSharedPointer< Style > StylePointer
Convenient alias of QSharedPointer<Style>.
Definition: tghelpers.h:51
Tg::Widget::screen
Screen * screen() const
Returns the Screen on which this Widget is being drawn.
Definition: tgwidget.cpp:174
Tg::CheckBox
Definition: tgcheckbox.h:7
Tg::CheckBox::consumeKeyboardBuffer
void consumeKeyboardBuffer(const QString &keyboardBuffer) override
Called when Widget accepts focus and keyboardBuffer is not empty.
Definition: tgcheckbox.cpp:75
Tg::Button
Definition: tgbutton.h:9