KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
abstractlistmodel.h
1#ifndef ABSTRACTLISTMODEL_H
2#define ABSTRACTLISTMODEL_H
3#include "abstractitemmodel.h"
4
5/**
6 * @brief AbstractItemModel specialization for flat list models.
7 *
8 * Provides a data() override suitable for list views and adds a convenience
9 * method for deleting the item at a given index.
10 */
11class LIBKANOOPGUI_EXPORT AbstractListModel : public AbstractItemModel
12{
13 Q_OBJECT
14public:
15 /** @brief Construct with an optional parent. */
16 AbstractListModel(QObject* parent = nullptr);
17
18 /**
19 * @brief Construct with a logging category and optional parent.
20 * @param loggingCategory Category name used for log output
21 * @param parent Optional QObject parent
22 */
23 AbstractListModel(const QString& loggingCategory, QObject* parent = nullptr);
24
25 /**
26 * @brief Remove the row at the given index from the model.
27 * @param index Model index of the row to delete
28 */
29 void deleteRowAtIndex(const QModelIndex& index);
30
31protected:
32 // AbstractItemModel interface
33 /** @brief Return the data for the given index and role. */
34 virtual QVariant data(const QModelIndex &index, int role) const override;
35};
36
37#endif // ABSTRACTLISTMODEL_H
Extended QAbstractItemModel providing EntityMetadata-based item lookup and header management.
AbstractItemModel specialization for flat list models.
void deleteRowAtIndex(const QModelIndex &index)
Remove the row at the given index from the model.
AbstractListModel(const QString &loggingCategory, QObject *parent=nullptr)
Construct with a logging category and optional parent.
virtual QVariant data(const QModelIndex &index, int role) const override
Return the data for the given index and role.
AbstractListModel(QObject *parent=nullptr)
Construct with an optional parent.