From c58ddf7073e97208161ca1d8eb0a8eeba08eae83 Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Sat, 9 Oct 2021 09:09:05 +0800 Subject: [PATCH] - fix: The Enter key in the numpad doesn't work - fix: The compiled executable not fully write to the disk before run it - fix: settings object not correctly released when exit --- NEWS.md | 3 +++ RedPandaIDE/editor.cpp | 3 +++ RedPandaIDE/main.cpp | 3 ++- RedPandaIDE/mainwindow.cpp | 1 + RedPandaIDE/qsynedit/KeyStrokes.cpp | 2 ++ RedPandaIDE/qsynedit/SynEdit.cpp | 2 ++ RedPandaIDE/widgets/qconsole.cpp | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a9445e8e..e1191278 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ Version 0.6.1 - fix: editor deadlock + - fix: The Enter key in the numpad doesn't work + - fix: The compiled executable not fully write to the disk before run it + - fix: settings object not correctly released when exit Version 0.6.0 - fix: old data not displayed when editing code snippets diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index e3eaae54..8c268d5b 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -497,6 +497,7 @@ void Editor::keyPressEvent(QKeyEvent *event) switch (event->key()) { case Qt::Key_Return: + case Qt::Key_Enter: mLastIdCharPressed = 0; if (mTabStopBegin>=0) { // editing user code template handled = true; @@ -2352,6 +2353,7 @@ bool Editor::onCompletionKeyPressed(QKeyEvent *event) mCompletionPopup->hide(); return true; case Qt::Key_Return: + case Qt::Key_Enter: case Qt::Key_Tab: completionInsert(pSettings->codeCompletion().appendFunc()); return true; @@ -2403,6 +2405,7 @@ bool Editor::onHeaderCompletionKeyPressed(QKeyEvent *event) mHeaderCompletionPopup->hide(); return true; case Qt::Key_Return: + case Qt::Key_Enter: case Qt::Key_Tab: headerCompletionInsert(); mHeaderCompletionPopup->hide(); diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 0b07db67..b221ca2d 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -139,10 +139,11 @@ int main(int argc, char *argv[]) app.installNativeEventFilter(&filter); int retCode = app.exec(); QString configDir = pSettings->dirs().config(); - delete pSettings; // save settings // settings->compilerSets().saveSets(); if (mainWindow.shouldRemoveAllSettings()) { + settings.release(); + delete pSettings; QDir dir(configDir); dir.removeRecursively(); } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index a852fbb3..39dcda8f 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2767,6 +2767,7 @@ void MainWindow::onCompileFinished() //run succession task if there aren't any errors if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) { + QThread::msleep(500); // wait for exec file writed to disk; switch (mCompileSuccessionTask->type) { case MainWindow::CompileSuccessionTaskType::Run: runExecutable(mCompileSuccessionTask->filename); diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/RedPandaIDE/qsynedit/KeyStrokes.cpp index f71084cb..5b4a1d8f 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.cpp +++ b/RedPandaIDE/qsynedit/KeyStrokes.cpp @@ -203,6 +203,8 @@ void SynEditKeyStrokes::resetDefaults() add(SynEditorCommand::ecRedo, Qt::Key_Backspace, Qt::AltModifier|Qt::ShiftModifier); add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::NoModifier); add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::ShiftModifier); + add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::KeypadModifier); + add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::KeypadModifier|Qt::ShiftModifier); add(SynEditorCommand::ecTab, Qt::Key_Tab, Qt::NoModifier); add(SynEditorCommand::ecShiftTab, Qt::Key_Backtab, Qt::ShiftModifier); add(SynEditorCommand::ecShiftTab, Qt::Key_Tab, Qt::ShiftModifier); diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index ab9bd1b5..09d5f1c9 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -21,6 +21,8 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) { + mLastKey = 0; + mLastKeyModifiers = Qt::NoModifier; mModified = false; mPaintLock = 0; mPainterLock = 0; diff --git a/RedPandaIDE/widgets/qconsole.cpp b/RedPandaIDE/widgets/qconsole.cpp index e2f03e97..4ecf76e6 100644 --- a/RedPandaIDE/widgets/qconsole.cpp +++ b/RedPandaIDE/widgets/qconsole.cpp @@ -554,6 +554,7 @@ void QConsole::keyPressEvent(QKeyEvent *event) { switch(event->key()) { case Qt::Key_Return: + case Qt::Key_Enter: event->accept(); if (mReadonly) return;