|
|
@ -989,8 +989,11 @@ TimelineModel::data(const QModelIndex &index, int role) const |
|
|
|
void |
|
|
|
void |
|
|
|
TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const |
|
|
|
TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (index.row() < 0 && index.row() >= rowCount()) |
|
|
|
if (index.row() < 0 && index.row() >= rowCount()) { |
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) |
|
|
|
|
|
|
|
roleData.clearData(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// HACK(Nico): fetchMore likes to break with dynamically sized delegates and reuseItems
|
|
|
|
// HACK(Nico): fetchMore likes to break with dynamically sized delegates and reuseItems
|
|
|
|
if (index.row() + 1 == rowCount() && !m_paginationInProgress) |
|
|
|
if (index.row() + 1 == rowCount() && !m_paginationInProgress) |
|
|
@ -998,13 +1001,14 @@ TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSp |
|
|
|
|
|
|
|
|
|
|
|
auto event = events.get(rowCount() - index.row() - 1); |
|
|
|
auto event = events.get(rowCount() - index.row() - 1); |
|
|
|
|
|
|
|
|
|
|
|
if (!event) |
|
|
|
if (!event) { |
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) |
|
|
|
|
|
|
|
roleData.clearData(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) { |
|
|
|
for (QModelRoleData &roleData : roleDataSpan) { |
|
|
|
int role = roleData.role(); |
|
|
|
roleData.setData(data(*event, roleData.role())); |
|
|
|
|
|
|
|
|
|
|
|
roleData.setData(data(*event, role)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1013,13 +1017,19 @@ TimelineModel::multiData(const QString &id, |
|
|
|
const QString &relatedTo, |
|
|
|
const QString &relatedTo, |
|
|
|
QModelRoleDataSpan roleDataSpan) const |
|
|
|
QModelRoleDataSpan roleDataSpan) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (id.isEmpty()) |
|
|
|
if (id.isEmpty()) { |
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) |
|
|
|
|
|
|
|
roleData.clearData(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto event = events.get(id.toStdString(), relatedTo.toStdString()); |
|
|
|
auto event = events.get(id.toStdString(), relatedTo.toStdString()); |
|
|
|
|
|
|
|
|
|
|
|
if (!event) |
|
|
|
if (!event) { |
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) |
|
|
|
|
|
|
|
roleData.clearData(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (QModelRoleData &roleData : roleDataSpan) { |
|
|
|
for (QModelRoleData &roleData : roleDataSpan) { |
|
|
|
int role = roleData.role(); |
|
|
|
int role = roleData.role(); |
|
|
|