From 785614607cfdde030b007f1c76fbc5f13b548bad Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 29 Sep 2024 20:39:57 +0800 Subject: [PATCH] =?UTF-8?q?-=20fix:=20=20When=20debugging=20project,=20the?= =?UTF-8?q?=20executing=20source=20file=20is=20not=20auto=20switched=20to.?= =?UTF-8?q?=20=EF=BC=88#476=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NEWS.md | 2 ++ RedPandaIDE/editor.cpp | 5 +++-- RedPandaIDE/editor.h | 2 +- RedPandaIDE/mainwindow.cpp | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index a43845e6..50d9aaf2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,8 @@ Red Panda C++ Version 3.2 - fix: Crash in windows 7. (by CyanoHao) - fix: While Control is pressed, can't start Drag&Drop by mouse. - enhancement: Auto detect gdb ACP (by CyanoHao) + - fix: When debugging project, the executing source file is not auto switched to. (#476) + Red Panda C++ Version 3.1 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 5f5c5e41..b3eec1c5 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -608,11 +608,12 @@ void Editor::setFilename(const QString &newName) return; } -void Editor::activate() +void Editor::activate(bool focus) { if (mParentPageControl) mParentPageControl->setCurrentWidget(this); - setFocus(); + if (focus) + setFocus(); } const QByteArray& Editor::encodingOption() const noexcept{ diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 4ac05111..ff12070e 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -150,7 +150,7 @@ public: bool save(bool force=false, bool reparse=true); bool saveAs(const QString& name="", bool fromProject = false); void setFilename(const QString& newName); - void activate(); + void activate(bool focus=true); QTabWidget* pageControl() noexcept; void setPageControl(QTabWidget* newPageControl); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index b2bda0a0..eee23fae 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1163,6 +1163,7 @@ void MainWindow::setActiveBreakpoint(QString fileName, int Line, bool setFocus) Editor *e = openFile(fileName, false); if (e!=nullptr) { e->setActiveBreakpointFocus(Line,setFocus); + e->activate(false); if (setFocus) { activateWindow(); }