void Explorer::on_lvDirs_activated(const QModelIndex& index_) { QString path = _model->filePath(index_); if (_model->isDir(index_)) { navigate(path); return; } emit fileClicked(path); }
void ProjectTree::on_itemClicked(QTreeWidgetItem *item, int column) { ProjectTreeItem *clickedItem = static_cast<ProjectTreeItem*>(item); if (clickedItem->getFileInfo()->isDir()) { if (clickedItem->isExpanded()) clickedItem->setExpanded(false); else clickedItem->setExpanded(true); } else emit fileClicked(clickedItem); (void)column; }
void ProjectExplorer::fileClick() { int row = -1; QString rootpath = m_FileSystemModel->rootPath() + QString("/"); QModelIndexList indexlist = m_TreeView->selectionModel()->selectedIndexes(); foreach(QModelIndex index, indexlist) { if(index.row() != row && index.column() == 0) { QFileInfo fileInfo = m_FileSystemModel->fileInfo(index); QString absoultepath = fileInfo.filePath(); QString file = absoultepath.remove(rootpath); row = index.row(); emit fileClicked(file); } } }