|
|
|
@ -288,9 +288,11 @@ void MessageList::saveChannelState() { |
|
|
|
|
|
|
|
|
|
|
|
int vpHeight = m_view->viewport()->height(); |
|
|
|
int vpHeight = m_view->viewport()->height(); |
|
|
|
QModelIndex topIdx = m_view->indexAt(QPoint(0, 0)); |
|
|
|
QModelIndex topIdx = m_view->indexAt(QPoint(0, 0)); |
|
|
|
|
|
|
|
QScrollBar* sb = m_view->verticalScrollBar(); |
|
|
|
|
|
|
|
bool atBottom = sb && (sb->value() >= sb->maximum()); |
|
|
|
|
|
|
|
|
|
|
|
qint64 lastPosMsgId = 0; |
|
|
|
qint64 lastPosMsgId = 0; |
|
|
|
if (topIdx.isValid()) |
|
|
|
if (!atBottom && topIdx.isValid()) |
|
|
|
lastPosMsgId = topIdx.data(MsgIdRole).toLongLong(); |
|
|
|
lastPosMsgId = topIdx.data(MsgIdRole).toLongLong(); |
|
|
|
|
|
|
|
|
|
|
|
qint64 lastReadMsgId = m_lastReadMsgId; |
|
|
|
qint64 lastReadMsgId = m_lastReadMsgId; |
|
|
|
@ -353,7 +355,9 @@ void MessageList::updateReadPosition() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QModelIndex topIdx = m_view->indexAt(QPoint(0, 0)); |
|
|
|
QModelIndex topIdx = m_view->indexAt(QPoint(0, 0)); |
|
|
|
qint64 lastPosMsgId = topIdx.isValid() ? topIdx.data(MsgIdRole).toLongLong() : 0; |
|
|
|
QScrollBar* sb = m_view->verticalScrollBar(); |
|
|
|
|
|
|
|
bool atBottom = sb && (sb->value() >= sb->maximum()); |
|
|
|
|
|
|
|
qint64 lastPosMsgId = (!atBottom && topIdx.isValid()) ? topIdx.data(MsgIdRole).toLongLong() : 0; |
|
|
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, |
|
|
|
"MessageList::updateReadPosition ch=%s oldRead=%lld newRead=%lld pos=%lld lastVisRow=%d/%d", |
|
|
|
"MessageList::updateReadPosition ch=%s oldRead=%lld newRead=%lld pos=%lld lastVisRow=%d/%d", |
|
|
|
|