Code review changes (comment added)

Add a comment which describes that only the folder is opened without
selecting any file. Also explain why it is only done like this for now.
This commit is contained in:
Michael Gregorius
2020-04-21 20:12:50 +02:00
parent b85aef2f33
commit c37fdd0055

View File

@@ -692,6 +692,12 @@ void FileBrowserTreeWidget::openContainingFolder()
{
if (m_contextMenuItem)
{
// Delegate to QDesktopServices::openUrl with the directory of the selected file. Please note that
// this will only open the directory but not select the file as this is much more complicated due
// to different implementations that are needed for different platforms (Linux/Windows/MacOS).
// Using QDesktopServices::openUrl seems to be the most simple cross platform way which uses
// functionality that's already available in Qt.
QFileInfo fileInfo(m_contextMenuItem->fullName());
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.dir().path()));
}