Double click in file tree open file
This commit is contained in:
@@ -122,3 +122,13 @@ void Filetree::contextMenuEvent(QContextMenuEvent *event)
|
||||
emit indexDirectory(m_fileSystemModel->filePath(index));
|
||||
}
|
||||
}
|
||||
|
||||
void Filetree::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QModelIndex index = indexAt(event->pos());
|
||||
QFileInfo info = m_fileSystemModel->fileInfo(index);
|
||||
if(info.isFile())
|
||||
emit fileSelected(info.filePath());
|
||||
else
|
||||
QTreeView::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
explicit Filetree(QWidget *parent = nullptr);
|
||||
~Filetree();
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
signals:
|
||||
void fileSelected(const QString &path);
|
||||
void copyFiles(const QString &path);
|
||||
|
||||
Reference in New Issue
Block a user