mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Support dialog rows with variable height.
This commit is contained in:
@@ -795,7 +795,9 @@ ShareBox::Inner::Chat *ShareBox::Inner::getChatAtIndex(int index) {
|
||||
}
|
||||
const auto row = [=] {
|
||||
if (_filter.isEmpty()) {
|
||||
return _chatsIndexed->rowAtY(index, 1);
|
||||
return (index < _chatsIndexed->size())
|
||||
? (_chatsIndexed->begin() + index)->get()
|
||||
: nullptr;
|
||||
}
|
||||
return (index < _filtered.size())
|
||||
? _filtered[index].get()
|
||||
@@ -865,9 +867,11 @@ void ShareBox::Inner::loadProfilePhotos(int yFrom) {
|
||||
|
||||
if (_filter.isEmpty()) {
|
||||
if (!_chatsIndexed->empty()) {
|
||||
auto i = _chatsIndexed->cfind(yFrom, _rowHeight);
|
||||
const auto index = yFrom / _rowHeight;
|
||||
auto i = _chatsIndexed->begin()
|
||||
+ std::min(index, _chatsIndexed->size());;
|
||||
for (auto end = _chatsIndexed->cend(); i != end; ++i) {
|
||||
if (((*i)->pos() * _rowHeight) >= yTo) {
|
||||
if (((*i)->index() * _rowHeight) >= yTo) {
|
||||
break;
|
||||
}
|
||||
(*i)->entry()->loadUserpic();
|
||||
@@ -973,7 +977,8 @@ void ShareBox::Inner::paintEvent(QPaintEvent *e) {
|
||||
auto indexTo = rowTo * _columnCount;
|
||||
if (_filter.isEmpty()) {
|
||||
if (!_chatsIndexed->empty()) {
|
||||
auto i = _chatsIndexed->cfind(indexFrom, 1);
|
||||
auto i = _chatsIndexed->begin()
|
||||
+ std::min(indexFrom, _chatsIndexed->size());
|
||||
for (auto end = _chatsIndexed->cend(); i != end; ++i) {
|
||||
if (indexFrom >= indexTo) {
|
||||
break;
|
||||
|
Reference in New Issue
Block a user