🐞 fix(UI模块): 添加自动加载

当时间栏被收起时,判断高度,进行自动加载后续时间栏
This commit is contained in:
huheng@kylinos.cn 2022-12-07 15:43:20 +08:00
parent 9b1651896a
commit 1d92b502b0
2 changed files with 13 additions and 0 deletions

View File

@ -207,6 +207,7 @@ void TimeLineListWidget::setItem(QList<FileInfo> 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)) {

View File

@ -44,6 +44,7 @@ private:
QSize getIconSize();
void setDownloadBtn(bool isShow);
void sendDownloadInfo();
void autoload();
Q_SIGNALS:
void sigOpenFile(FileInfo::FileType, QString);