Add section back.

Enable pixelAligned for flickable.
Tweak timeline delegate.
This commit is contained in:
Black Hat
2019-05-11 20:53:33 +08:00
parent 627647207b
commit 49545df607
12 changed files with 205 additions and 88 deletions

View File

@@ -35,6 +35,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const {
roles[ReplyDisplayRole] = "replyDisplay";
roles[UserMarkerRole] = "userMarker";
roles[ShowAuthorRole] = "showAuthor";
roles[ShowSectionRole] = "showSection";
roles[BubbleShapeRole] = "bubbleShape";
return roles;
}
@@ -289,7 +290,8 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
case MessageEventType::Audio:
return "audio";
}
if (e->hasFileContent()) return "file";
if (e->hasFileContent())
return "file";
return "message";
}
@@ -429,6 +431,19 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
return true;
}
if (role == ShowSectionRole) {
for (auto r = row + 1; r < rowCount(); ++r) {
auto i = index(r);
if (data(i, SpecialMarksRole) != EventStatus::Hidden) {
return data(i, TimeRole)
.toDateTime()
.msecsTo(data(idx, TimeRole).toDateTime()) > 600000;
}
}
return true;
}
if (role == BubbleShapeRole) { // TODO: Convoluted logic.
int aboveRow = -1; // Invalid