From 3a062c37928704ca09a9e586ab10ce0c5e6eb78a Mon Sep 17 00:00:00 2001 From: kate Date: Mon, 17 Jan 2022 02:37:53 +0800 Subject: [PATCH] fix: pasted files selection interaction --- main.cpp | 2 +- model/foldermodel.cpp | 9 ++++++--- qml/Dialogs/EmptyTrashDialog.qml | 4 ++-- qml/main.qml | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 19371aa..23faa0f 100644 --- a/main.cpp +++ b/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { - //QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); // Register QML Type. diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index d18f1d8..7ec2889 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -113,7 +113,7 @@ FolderModel::FolderModel(QObject *parent) m_showHiddenFiles = settings.value("showHiddenFiles", false).toBool(); m_updateNeedSelectTimer->setSingleShot(true); - m_updateNeedSelectTimer->setInterval(500); + m_updateNeedSelectTimer->setInterval(50); connect(m_updateNeedSelectTimer, &QTimer::timeout, this, &FolderModel::updateNeedSelectUrls); m_dirLister = new DirLister(this); @@ -1596,7 +1596,8 @@ void FolderModel::onRowsInserted(const QModelIndex &parent, int first, int last) } } - QTimer::singleShot(0, this, [=] { + // 新建文件夹需要先选择后再发送请求 + QTimer::singleShot(m_updateNeedSelectTimer->interval() + 10, this, [=] { if (changeIdx.isValid()) { setSelected(changeIdx.row()); emit requestRename(); @@ -1621,7 +1622,9 @@ void FolderModel::updateNeedSelectUrls() if (!idx.isValid()) continue; - needSelectList.append(idx); + const QModelIndex &sourceIdx = mapFromSource(idx); + + needSelectList.append(sourceIdx); } m_needSelectUrls.clear(); diff --git a/qml/Dialogs/EmptyTrashDialog.qml b/qml/Dialogs/EmptyTrashDialog.qml index 58a0c68..613dd05 100644 --- a/qml/Dialogs/EmptyTrashDialog.qml +++ b/qml/Dialogs/EmptyTrashDialog.qml @@ -38,8 +38,8 @@ FishUI.Window { width: contentWidth height: contentHeight - x: Screen.virtualX + (Screen.width - contentWidth) / 2 - y: Screen.virtualY + (Screen.height - contentHeight) / 2 +// x: Screen.virtualX + (Screen.width - contentWidth) / 2 +// y: Screen.virtualY + (Screen.height - contentHeight) / 2 minimumWidth: contentWidth minimumHeight: contentHeight diff --git a/qml/main.qml b/qml/main.qml index 37e2a77..4a57e5b 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -34,6 +34,7 @@ FishUI.Window { visible: true title: qsTr("File Manager") + background.opacity: 1 header.height: 36 + FishUI.Units.largeSpacing LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft