Init scroll to eventid.
This commit is contained in:
@@ -470,3 +470,12 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
int MessageEventModel::eventIDToIndex(const QString& eventID) {
|
||||
const auto it = m_currentRoom->findInTimeline(eventID);
|
||||
if (it == m_currentRoom->timelineEdge()) {
|
||||
qWarning() << "Trying to find inexistent event:" << eventID;
|
||||
return -1;
|
||||
}
|
||||
return it - m_currentRoom->messageEvents().rbegin() + timelineBaseIndex();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ class MessageEventModel : public QAbstractListModel {
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
Q_INVOKABLE int eventIDToIndex(const QString& eventID);
|
||||
|
||||
private slots:
|
||||
int refreshEvent(const QString& eventId);
|
||||
void refreshRow(int row);
|
||||
|
||||
Reference in New Issue
Block a user