1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix no visible line case

This commit is contained in:
krepa098 2015-01-03 15:32:12 +01:00
parent 2938702c1e
commit a0a56e32a0

View File

@ -192,15 +192,15 @@ void ChatLog::partialUpdate()
{ {
repos = false; repos = false;
if(!visibleLines.empty()) if(!visibleLines.empty())
{
repos = layout(visibleLines.first()->getRowIndex(), visibleLines.last()->getRowIndex(), useableWidth()); repos = layout(visibleLines.first()->getRowIndex(), visibleLines.last()->getRowIndex(), useableWidth());
}
checkVisibility(); checkVisibility();
} }
while(repos); while(repos);
reposition(visibleLines.last()->getRowIndex(), lines.size()); if(!visibleLines.empty())
reposition(visibleLines.last()->getRowIndex(), lines.size());
checkVisibility(); checkVisibility();
setViewportUpdateMode(oldUpdateMode); setViewportUpdateMode(oldUpdateMode);
@ -530,7 +530,14 @@ void ChatLog::checkVisibility()
}); });
if(upperBound == lines.end()) if(upperBound == lines.end())
upperBound = lines.begin(); {
//no lines visible
for(ChatLine* line : visibleLines)
line->visibilityChanged(false);
visibleLines.clear();
return;
}
// find last visible row // find last visible row
QList<ChatLine*>::const_iterator lowerBound; QList<ChatLine*>::const_iterator lowerBound;
@ -539,9 +546,6 @@ void ChatLog::checkVisibility()
return lhs->boundingSceneRect().bottom() < rhs; return lhs->boundingSceneRect().bottom() < rhs;
}); });
if(lowerBound == lines.end())
lowerBound = lines.end();
// set visibilty // set visibilty
QList<ChatLine*> newVisibleLines; QList<ChatLine*> newVisibleLines;
for(auto itr = upperBound; itr <= lowerBound && itr != lines.cend(); ++itr) for(auto itr = upperBound; itr <= lowerBound && itr != lines.cend(); ++itr)