Chrysalis - CLO3D Extensions
Toggle main menu visibility
Loading...
Searching...
No Matches
BaseListModel.h
Go to the documentation of this file.
1
#ifndef CHRYSALIS_BASEMODEL_H
2
#define CHRYSALIS_BASEMODEL_H
3
4
#include <QMetaType>
5
#include <QAbstractListModel>
6
7
#include "Parameter.h"
8
9
Q_DECLARE_METATYPE(Chrysalis::Parameter*)
10
11
namespace
CLO3D::UI
{
12
template
<
typename
T>
13
class
BaseModel
:
public
QAbstractListModel {
14
protected
:
15
explicit
BaseModel
(T*
data
): data_(
data
) {}
16
public
:
17
int
rowCount
(
const
QModelIndex& parent)
const override
{
18
return
data_->count();
19
}
20
QVariant
data
(
const
QModelIndex& index,
const
int
role)
const override
{
21
if
(role != Qt::UserRole)
return
{};
22
return
QVariant::fromValue((*data_)[index.row()]);
23
}
24
private
:
25
T* data_;
26
};
27
}
28
29
#endif
//CHRYSALIS_BASEMODEL_H
CLO3D::UI::BaseModel::rowCount
int rowCount(const QModelIndex &parent) const override
Definition
BaseListModel.h:17
CLO3D::UI::BaseModel::data
QVariant data(const QModelIndex &index, const int role) const override
Definition
BaseListModel.h:20
CLO3D::UI::BaseModel::BaseModel
BaseModel(T *data)
Definition
BaseListModel.h:15
CLO3D::UI
Definition
BaseCommandArgumentsWidget.h:10
integrations
clo3d
include
BaseListModel.h
Generated by
1.17.0