Implemented creating of new light types or lights
This commit is contained in:
1 parent
7c580d53b4
commit
9a5e2d3cd7
6 files changed
+90
-2
No files matched your search
@@ -195,6 +195,41 @@ bool DeviceTypesModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTypesModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
if (parent.isValid())
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_controller)
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &lightTypes = m_controller->lightProject().lightTypes;
|
||||
|
||||
if (row < 0)
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (row > lightTypes.size())
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
return false;
|
||||
}
|
||||
|
||||
beginInsertRows({}, row, row+count-1);
|
||||
lightTypes.insert(std::begin(lightTypes) + row, count, LightTypeConfig{ .id=99, .name="<neu>" });
|
||||
endInsertRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceTypesModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
if (parent.isValid())
|
||||
@@ -211,6 +246,12 @@ bool DeviceTypesModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
|
||||
auto &lightTypes = m_controller->lightProject().lightTypes;
|
||||
|
||||
if (row < 0)
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (row >= lightTypes.size())
|
||||
{
|
||||
qWarning() << "hilfe" << __LINE__;
|
||||
|
||||
Reference in new issue
Block a user