Browse Source

fix no visible line case

pull/974/head
krepa098 11 years ago
parent
commit
a0a56e32a0
  1. 18
      src/chatlog/chatlog.cpp

18
src/chatlog/chatlog.cpp

@ -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)

Loading…
Cancel
Save