File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1088,6 +1088,31 @@ void FilesDock::updateViewMode()
10881088
10891089void FilesDock::keyPressEvent (QKeyEvent *event)
10901090{
1091+ LOG_DEBUG () << event;
1092+ #if defined(Q_OS_MAC)
1093+ if (event->key () == Qt::Key_Return || event->key () == Qt::Key_Enter) {
1094+ if (!m_view->selectionModel ()->selectedIndexes ().isEmpty ()) {
1095+ const auto index = m_view->selectionModel ()->selectedIndexes ().first ();
1096+ if (index.isValid ()) {
1097+ const auto sourceIndex = m_filesProxyModel->mapToSource (index);
1098+ const auto filePath = m_filesModel->filePath (sourceIndex);
1099+ if (m_filesModel->isDir (sourceIndex)) {
1100+ m_filesModel->setRootPath (filePath);
1101+ m_view->setRootIndex (index);
1102+ m_view->scrollToTop ();
1103+ const auto dirsIndex = m_dirsModel.index (filePath);
1104+ ui->treeView ->setExpanded (dirsIndex, true );
1105+ ui->treeView ->scrollTo (dirsIndex);
1106+ ui->treeView ->setCurrentIndex (dirsIndex);
1107+ return ;
1108+ }
1109+ emit clipOpened (filePath);
1110+ }
1111+ }
1112+ event->accept ();
1113+ return ;
1114+ }
1115+ #endif
10911116 QDockWidget::keyPressEvent (event);
10921117 if (event->key () == Qt::Key_Up || event->key () == Qt::Key_Down)
10931118 event->accept ();
You can’t perform that action at this time.
0 commit comments