[FIX] 【文件管理器】重命名文件时右键空白处,文件名处显示为空 [LINK]181741

This commit is contained in:
yangyanwei 2023-07-17 16:05:24 +08:00 committed by Yue-Lan
parent 72f3488f4b
commit 077faf68e3
1 changed files with 10 additions and 4 deletions

View File

@ -547,6 +547,7 @@ void IconViewDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
//set focus to fix bug#54061
getView()->setFocus();
});
infoJob->queryAsync();
});
}, Qt::BlockingQueuedConnection);
@ -558,10 +559,15 @@ void IconViewDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
auto info = renameOp->getOperationInfo().get();
auto uri = info->target();
QTimer::singleShot(100, getView(), [=](){
getView()->setSelections(QStringList()<<uri);
getView()->scrollToSelection(uri);
//set focus to fix bug#54061
getView()->setFocus();
auto infoJob = new Peony::FileInfoJob(Peony::FileInfo::fromUri(uri));
infoJob->setAutoDelete();
connect(infoJob, &Peony::FileInfoJob::queryAsyncFinished, this, [=]() {
getView()->setSelections(QStringList()<<uri);
getView()->scrollToSelection(uri);
//set focus to fix bug#54061
getView()->setFocus();
});
infoJob->queryAsync();
});
}, Qt::BlockingQueuedConnection);