Add register groups model

This commit is contained in:
2023-02-19 20:14:36 +01:00
parent f75448111a
commit e94ee5dd54
20 changed files with 243 additions and 53 deletions

View File

@ -6,10 +6,12 @@
#include <QCoreApplication>
#include <QQmlEngine>
constexpr auto IdRole = Qt::UserRole;
constexpr auto DeviceTypeIdRole = Qt::UserRole + 1;
constexpr auto AddressRole = Qt::UserRole + 2;
constexpr auto PositionRole = Qt::UserRole + 3;
enum {
IdRole = Qt::UserRole,
DeviceTypeIdRole,
AddressRole,
PositionRole
};
void DevicesModel::setController(DmxController *controller)
{
@ -33,7 +35,8 @@ int DevicesModel::rowCount(const QModelIndex &parent) const
if (!m_controller)
return 0;
return m_controller->lightProject().devices.size();
const auto &devices = m_controller->lightProject().devices;
return devices.size();
}
QVariant DevicesModel::data(const QModelIndex &index, int role) const
@ -291,9 +294,9 @@ bool DevicesModel::removeRows(int row, int count, const QModelIndex &parent)
}
namespace {
void registerDenShit()
void registrierDenShit()
{
qmlRegisterType<DevicesModel>("com.büro", 1, 0, "DevicesModel");
qmlRegisterType<DevicesModel>("lightcontrol", 1, 0, "DevicesModel");
}
}
Q_COREAPP_STARTUP_FUNCTION(registerDenShit)
Q_COREAPP_STARTUP_FUNCTION(registrierDenShit)