QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ObjectListModelBase.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 *
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
7 *
8 ****************************************************************************/
9
10
11#pragma once
12
13#include "ObjectItemModelBase.h"
14
15Q_DECLARE_LOGGING_CATEGORY(ObjectListModelBaseLog)
16
17
20{
21 Q_OBJECT
22
23public:
24 ObjectListModelBase(QObject* parent = nullptr);
25 ~ObjectListModelBase() override;
26
27 virtual void clearAndDeleteContents() = 0;
28 virtual QObject* removeOne(const QObject* object) = 0;
29 virtual bool contains(const QObject* object) = 0;
30
31 // Flat-list overrides of QAbstractItemModel — same behavior as QAbstractListModel
32 QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const override;
33 QModelIndex parent(const QModelIndex& child) const override;
34 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
35 bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
36
37protected:
38 // Overrides from QAbstractItemModel which must be implemented by derived classes
39 int rowCount(const QModelIndex& parent = QModelIndex()) const override = 0;
40 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override = 0;
41 bool insertRows(int position, int rows, const QModelIndex& index = QModelIndex()) override = 0;
42 bool removeRows(int position, int rows, const QModelIndex& index = QModelIndex()) override = 0;
43 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override = 0;
44
45 bool _skipDirtyFirstItem = false;
46};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
int rowCount(const QModelIndex &parent=QModelIndex()) const override=0
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override=0
bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex()) override=0
virtual bool contains(const QObject *object)=0
virtual void clearAndDeleteContents()=0
Clears the list and calls deleteLater on each entry.
bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex()) override=0
virtual QObject * removeOne(const QObject *object)=0
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override=0