Actually position the view at the end

It turns out that for whatever reason ListView.posiitionViewAtEnd() ignores any whitespace. This means that when we use the function it goes to the last delegate. This is no good as we have some padding at the bottom to make space for the typing indicator.

So the fix for this is stupid and involves adding a "spacer" delegate to the timeline beginning model which is completely invisible but qml see as a delegate so we can both leave the space and properly position the view at the end.

BUG: 501075
This commit is contained in:
James Graham
2025-06-01 10:37:30 +01:00
parent 5ec0b9393e
commit dec5369a8f
6 changed files with 22 additions and 3 deletions

View File

@@ -81,12 +81,14 @@ void TimelineBeginningModel::setRoom(NeoChatRoom *room)
QVariant TimelineBeginningModel::data(const QModelIndex &idx, int role) const
{
Q_UNUSED(idx)
if (m_room == nullptr) {
return {};
}
if (role == DelegateTypeRole) {
if (idx.row() == 0) {
return DelegateType::Spacer;
}
return DelegateType::Successor;
}
return {};
@@ -98,7 +100,7 @@ int TimelineBeginningModel::rowCount(const QModelIndex &parent) const
if (m_room == nullptr) {
return 1;
}
return m_room->successorId().isEmpty() ? 0 : 1;
return m_room->successorId().isEmpty() ? 1 : 2;
}
QHash<int, QByteArray> TimelineBeginningModel::roleNames() const