对话框显示模式在内容加载后再设置

This commit is contained in:
tanjing 2023-11-01 16:12:24 +08:00 committed by xibowen
parent 8d4c5947f6
commit c88380eb16
1 changed files with 5 additions and 4 deletions

View File

@ -2665,6 +2665,11 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
}
}
if(options()->viewMode() == QFileDialog::List && mKyFileDialog->viewMode() != KyNativeFileDialog::Icon)
mKyFileDialog->setViewMode(KyNativeFileDialog::Icon);
else if(options()->viewMode() == QFileDialog::Detail && mKyFileDialog->viewMode() != KyNativeFileDialog::List)
mKyFileDialog->setViewMode(KyNativeFileDialog::List);
QString platform = QGuiApplication::platformName();
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
{
@ -2713,10 +2718,6 @@ void KyFileDialogHelper::initDialog()
pDebug << "initDialog filters:" << options()->nameFilters();
mKyFileDialog->setNameFilters(options()->nameFilters());
pDebug << "view mode:" << options()->viewMode() << mKyFileDialog->viewMode();
if(options()->viewMode() == QFileDialog::List && mKyFileDialog->viewMode() != KyNativeFileDialog::Icon)
mKyFileDialog->setViewMode(KyNativeFileDialog::Icon);
else if(options()->viewMode() == QFileDialog::Detail && mKyFileDialog->viewMode() != KyNativeFileDialog::List)
mKyFileDialog->setViewMode(KyNativeFileDialog::List);
for(int i = 0; i < QFileDialogOptions::DialogLabelCount; ++i) {
auto label = static_cast<QFileDialogOptions::DialogLabel>(i);