void GopathBrowser::setStartIndex(const QModelIndex &index) { QModelIndex oldIndex = m_model->startIndex(); if (oldIndex != index) { m_model->setStartIndex(index); m_pathTree->update(oldIndex); m_pathTree->update(index); emit startPathChanged(m_model->filePath(index)); PathNode *node = m_model->nodeFromIndex(index); if (node) { m_startPathLabel->setText(QString("<p><a href file://%1>%2</p>").arg(node->path()).arg(node->text())); m_startPathLabel->setToolTip(node->path()); } } }
void GopathBrowser::openPathIndex(const QModelIndex &index) { PathNode *node = m_model->nodeFromIndex(index); if (!node) { return; } if (node->isDir()) { this->setStartIndex(index); } else if (node->isFile()) { if (m_syncProject->isChecked()) { this->setStartIndex(index.parent()); } m_liteApp->fileManager()->openEditor(node->path(),true); } }