PyQt5 |如何打开带有预选文件的文件夹?

PyQt5 | How to open a folder with a file preselected?

目前我可以使用

打开文件夹
dirPath = os.path.dirname(os.path.abspath(self.oVidPath))
QDesktopServices.openUrl(QUrl.fromLocalFile(dirPath))

我想知道我是否可以打开带有预选文件的文件夹?

如果它只适用于 linux 系统(首选 nautilus)我没问题

编辑:此应用程序仅适用于 linux 系统

对于windows

import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.Qt import QProcess

if __name__ == '__main__':
    app = QApplication(sys.argv)
    command = "explorer /e, /select, c:\windows\regedit.exe"
    process = QProcess()
    process.start(command)
    sys.exit(app.exec_())

对于Linux

import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.Qt import QProcess

if __name__ == '__main__':
    app = QApplication(sys.argv)
    command = "nautilus /var/log/dpkg.log"
    process = QProcess()
    process.start(command)
    sys.exit(app.exec_())

仅供参考 https://askubuntu.com/a/82717/249546