diff --git a/NEWS.md b/NEWS.md index 8657cbb6c..d716379b6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,7 @@ Red Panda C++ Version 3.3 - enhancement: Add the option "Clear symbols in hidden source files" in option / environment / performance. (Turned on by default) - enhancement: Treat .tcc file as C/C++ header file. - enhancement: Save encoding / filetype /context file infos of last openned files. + - fix: Class browser is empty when ctrl+click to open a file. Red Panda C++ Version 3.2 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 1e99c0660..0fcdfc73c 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1502,17 +1502,13 @@ void Editor::showEvent(QShowEvent */*event*/) this, &Editor::onEndParsing); if (!pMainWindow->openingFiles() && !pMainWindow->openingProject()) { - bool needReparse=((isC_CPPHeaderFile(mFileType) - && !mContextFile.isEmpty() - && !mParser->isFileParsed(mContextFile)) - || (!mParser->isFileParsed(mFilename))); if (pSettings->codeCompletion().clearWhenEditorHidden() && pSettings->codeCompletion().shareParser() && !inProject()) { - if (needReparse) + if (needReparse()) resetCppParser(mParser); } - if (needReparse) { + if (needReparse()) { reparse(false); } } @@ -4613,10 +4609,20 @@ Editor* Editor::openFileInContext(const QString &filename) e->setContextFile(mContextFile); } } + if (e->isVisible()) + pMainWindow->updateClassBrowserForEditor(e); } return e; } +bool Editor::needReparse() +{ + return mParser && ((isC_CPPHeaderFile(mFileType) + && !mContextFile.isEmpty() + && !mParser->isFileParsed(mContextFile)) + || (!mParser->isFileParsed(mFilename))); +} + const QString &Editor::contextFile() const { return mContextFile; diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 5c5a893f7..1a4aa17cb 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -331,6 +331,7 @@ private slots: void doSetFileType(FileType newFileType, bool force=false); Editor* openFileInContext(const QString& filename); + bool needReparse(); private: bool mInited; diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index fbdac35b1..ad645763d 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1627,7 +1627,6 @@ void MainWindow::updateClassBrowserForEditor(Editor *editor) return; } - mClassBrowserModel->beginUpdate(); mClassBrowserModel->setParser(editor->parser()); if (editor->inProject()) {