diff --git a/ui/filemanageview/timelinelistwidget.cpp b/ui/filemanageview/timelinelistwidget.cpp index f5dfc7b..c10dd5e 100644 --- a/ui/filemanageview/timelinelistwidget.cpp +++ b/ui/filemanageview/timelinelistwidget.cpp @@ -207,6 +207,7 @@ void TimeLineListWidget::setItem(QList list) connect(itemWin, &TimeLineItem::sigItemSelectAll, this, &TimeLineListWidget::slotItemSelecAll); connect(itemWin, &TimeLineItem::sigSizeChanged, this, [=](QSize size) { item->setSizeHint(size); + autoload(); }); connect(itemWin, &TimeLineItem::sigCtrlAClicked, this, [=]() { selectAll(); @@ -283,6 +284,17 @@ void TimeLineListWidget::sendDownloadInfo() Q_EMIT sigDownFileInfo(filePath, fileList); } +void TimeLineListWidget::autoload() +{ + int currentHeight = 0; + for (int i = 0; i < count(); i++) { + currentHeight += item(i)->sizeHint().height(); + } + if (currentHeight <= height()) { + loadItem(2); + } +} + void TimeLineListWidget::slotValueChanged(int value) { if (value > (verticalScrollBar()->maximum() * 2 / 3)) { diff --git a/ui/filemanageview/timelinelistwidget.h b/ui/filemanageview/timelinelistwidget.h index 31a61fe..231d398 100644 --- a/ui/filemanageview/timelinelistwidget.h +++ b/ui/filemanageview/timelinelistwidget.h @@ -44,6 +44,7 @@ private: QSize getIconSize(); void setDownloadBtn(bool isShow); void sendDownloadInfo(); + void autoload(); Q_SIGNALS: void sigOpenFile(FileInfo::FileType, QString);