terminalgui  0.1.0
Widgets for your terminal, powered by Qt! Create textual GUI (TUI) in your console easily.
tgcheckablestringlistmodel.h
1 #pragma once
2 
3 #include <tgcolor.h>
4 
5 #include <QAbstractListModel>
6 
7 namespace Tg {
9  Qt::CheckState checkState = Qt::CheckState::Unchecked;
10  QString string;
11  Color color;
12 };
13 
14 using CheckableStringList = QList<CheckableString>;
15 
16 class CheckableStringListModel : public QAbstractListModel
17 {
18  Q_OBJECT
19 
20 public:
21  CheckableStringListModel(const QStringList &data, QObject *parent = nullptr);
22  CheckableStringListModel(const CheckableStringList &data, QObject *parent = nullptr);
23 
24  Qt::ItemFlags flags(const QModelIndex &index) const override;
25  int rowCount(const QModelIndex &parent) const override;
26  QVariant data(const QModelIndex &index, int role) const override;
27  bool setData(const QModelIndex &index, const QVariant &value, int role) override;
28 
29 private:
30  CheckableStringList _data;
31 };
32 }
Tg
All Terminal GUI classes (both core and widgets) are defined within the Tg namespace.
Definition: tgcolor.h:6
Tg::Color
Represents colors in a terminal.
Definition: tgcolor.h:20
Tg::CheckableStringListModel
Definition: tgcheckablestringlistmodel.h:17
Tg::CheckableString
Definition: tgcheckablestringlistmodel.h:8