From 83fb0ac726976aa1073a28c8e23d35d5ef5dfe32 Mon Sep 17 00:00:00 2001 From: liyigang Date: Thu, 11 Jul 2024 11:35:58 +0800 Subject: [PATCH] fix: When renaming files in bulk, the focus is not on the "Find" input box When renamebar is displayed, set the focus of the first lineedit Log: When renaming files in bulk, the focus is not on the "Find" input box Bug: https://pms.uniontech.com/bug-view-263817.html --- src/dfm-base/utils/networkutils.cpp | 4 ++-- .../core/dfmplugin-workspace/views/renamebar.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dfm-base/utils/networkutils.cpp b/src/dfm-base/utils/networkutils.cpp index 1de93f4682..02eb43f362 100644 --- a/src/dfm-base/utils/networkutils.cpp +++ b/src/dfm-base/utils/networkutils.cpp @@ -198,11 +198,11 @@ QMap NetworkUtils::cifsMountHostInfo() continue; // net work mount must start with // QString srcHostAndPort = mnt_fs_get_source(fs); - if (!srcHostAndPort.contains(QRegExp("^//"))) + if (!srcHostAndPort.contains(QRegularExpression("^//"))) continue; const QString &mountPath = mnt_fs_get_target(fs); - srcHostAndPort = srcHostAndPort.replace(QRegExp("^//"), ""); + srcHostAndPort = srcHostAndPort.replace(QRegularExpression("^//"), ""); srcHostAndPort = srcHostAndPort.left(srcHostAndPort.indexOf("/")); table.insert(mountPath, srcHostAndPort); } diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/views/renamebar.cpp b/src/plugins/filemanager/core/dfmplugin-workspace/views/renamebar.cpp index 4f3706bc6a..80afde2115 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/views/renamebar.cpp +++ b/src/plugins/filemanager/core/dfmplugin-workspace/views/renamebar.cpp @@ -75,6 +75,12 @@ void RenameBar::setVisible(bool visible) } } } + if (visible) { + QLineEdit *lineEdit { std::get<1>(d->replaceOperatorItems) }; + if (lineEdit) + lineEdit->setFocus(); + } + return QFrame::setVisible(visible); }