diff --git a/NEWS.md b/NEWS.md index 4f3012d5..75eeb84f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,8 @@ Red Panda C++ Version 1.0.1 - fix: the problem & problem set panel can't be correctly , if problem set is enabled - fix: disable code completion doesn't correctly disable project parser - enhancement: slightly reduce memory usage for code parser + - enhancement: switch capslock won't cancel code completion + - enhancement: double click on item in code completion list will use it to complete Red Panda C++ Version 1.0.0 - fix: calculation for code snippets's tab stop positions is not correct diff --git a/RedPandaIDE/widgets/codecompletionlistview.cpp b/RedPandaIDE/widgets/codecompletionlistview.cpp index 582c91e3..f4adb9f5 100644 --- a/RedPandaIDE/widgets/codecompletionlistview.cpp +++ b/RedPandaIDE/widgets/codecompletionlistview.cpp @@ -33,6 +33,7 @@ void CodeCompletionListView::keyPressEvent(QKeyEvent *event) || event->key() == Qt::Key_PageUp || event->key() == Qt::Key_Home || event->key() == Qt::Key_End + || event->key() == Qt::Key_CapsLock ) { QListView::keyPressEvent(event); return; @@ -50,6 +51,13 @@ void CodeCompletionListView::focusInEvent(QFocusEvent *) } } +void CodeCompletionListView::mouseDoubleClickEvent(QMouseEvent *event) +{ + QKeyEvent keyEvent(QKeyEvent::Type::KeyPress,Qt::Key_Tab,Qt::KeyboardModifier::NoModifier, + "\t"); + keyPressEvent(&keyEvent); +} + const KeyPressedCallback &CodeCompletionListView::keypressedCallback() const { return mKeypressedCallback; diff --git a/RedPandaIDE/widgets/codecompletionlistview.h b/RedPandaIDE/widgets/codecompletionlistview.h index 89f1089f..1c6aa271 100644 --- a/RedPandaIDE/widgets/codecompletionlistview.h +++ b/RedPandaIDE/widgets/codecompletionlistview.h @@ -44,6 +44,10 @@ private: // QWidget interface protected: void focusInEvent(QFocusEvent *event) override; + + // QWidget interface +protected: + void mouseDoubleClickEvent(QMouseEvent *event) override; };