Fix only first 7 stickers showing up

This commit is contained in:
Nicolas Werner 2021-07-19 12:43:16 +02:00
parent 56b44a85b5
commit 9f416f1fc9
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 8 additions and 6 deletions

View file

@ -26,6 +26,12 @@ ImagePackModel::ImagePackModel(const std::string &roomId, bool stickers, QObject
} }
} }
int
ImagePackModel::rowCount(const QModelIndex &) const
{
return (int)images.size();
}
QHash<int, QByteArray> QHash<int, QByteArray>
ImagePackModel::roleNames() const ImagePackModel::roleNames() const
{ {

View file

@ -23,11 +23,7 @@ public:
ImagePackModel(const std::string &roomId, bool stickers, QObject *parent = nullptr); ImagePackModel(const std::string &roomId, bool stickers, QObject *parent = nullptr);
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override int rowCount(const QModelIndex &parent = QModelIndex()) const override;
{
(void)parent;
return (int)images.size();
}
QVariant data(const QModelIndex &index, int role) const override; QVariant data(const QModelIndex &index, int role) const override;
mtx::events::msc2545::PackImage imageAt(int row) mtx::events::msc2545::PackImage imageAt(int row)

View file

@ -597,7 +597,7 @@ TimelineViewManager::completerFor(QString completerName, QString roomId)
return proxy; return proxy;
} else if (completerName == "stickers") { } else if (completerName == "stickers") {
auto stickerModel = new ImagePackModel(roomId.toStdString(), true); auto stickerModel = new ImagePackModel(roomId.toStdString(), true);
auto proxy = new CompletionProxyModel(stickerModel); auto proxy = new CompletionProxyModel(stickerModel, 1, static_cast<size_t>(-1) / 4);
stickerModel->setParent(proxy); stickerModel->setParent(proxy);
return proxy; return proxy;
} }