Chatterino
GenericListModel.hpp
Go to the documentation of this file.
2 
3 #include <QAbstractListModel>
4 #include <QWidget>
5 #include <memory>
6 
7 namespace chatterino {
8 
9 class GenericListModel : public QAbstractListModel
10 {
11 public:
12  GenericListModel(QWidget *parent = nullptr);
13 
19  int rowCount(const QModelIndex &parent = QModelIndex()) const;
20 
30  QVariant data(const QModelIndex &index, int role) const;
31 
41  void addItem(std::unique_ptr<GenericListItem> item);
42 
48  void clear();
49 
50 private:
51  std::vector<std::unique_ptr<GenericListItem>> items_;
52 };
53 } // namespace chatterino
void clear()
Clears this QuickSwitcherModel of all items. This will delete all GenericListItems added after the la...
Definition: GenericListModel.cpp:37
Definition: Application.cpp:48
Definition: GenericListModel.hpp:9
void addItem(std::unique_ptr< GenericListItem > item)
Add an item to this QuickSwitcherModel. It will be displayed in attached views.
Definition: GenericListModel.cpp:28
QVariant data(const QModelIndex &index, int role) const
Reimplements QAbstractItemModel::data. Currently, the role parameter is not used and an GenericListIt...
Definition: GenericListModel.cpp:15
GenericListModel(QWidget *parent=nullptr)
Definition: GenericListModel.cpp:5
int rowCount(const QModelIndex &parent=QModelIndex()) const
Reimplements QAbstractItemModel::rowCount.
Definition: GenericListModel.cpp:10