- enhancement: switch capslock won't cancel code completion

- enhancement: double click on item in code completion list will use it to complete
This commit is contained in:
Roy Qu 2022-03-24 08:24:10 +08:00
parent a211992256
commit 33f838ef6a
3 changed files with 14 additions and 0 deletions

View File

@ -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: the problem & problem set panel can't be correctly , if problem set is enabled
- fix: disable code completion doesn't correctly disable project parser - fix: disable code completion doesn't correctly disable project parser
- enhancement: slightly reduce memory usage for code 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 Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct - fix: calculation for code snippets's tab stop positions is not correct

View File

@ -33,6 +33,7 @@ void CodeCompletionListView::keyPressEvent(QKeyEvent *event)
|| event->key() == Qt::Key_PageUp || event->key() == Qt::Key_PageUp
|| event->key() == Qt::Key_Home || event->key() == Qt::Key_Home
|| event->key() == Qt::Key_End || event->key() == Qt::Key_End
|| event->key() == Qt::Key_CapsLock
) { ) {
QListView::keyPressEvent(event); QListView::keyPressEvent(event);
return; 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 const KeyPressedCallback &CodeCompletionListView::keypressedCallback() const
{ {
return mKeypressedCallback; return mKeypressedCallback;

View File

@ -44,6 +44,10 @@ private:
// QWidget interface // QWidget interface
protected: protected:
void focusInEvent(QFocusEvent *event) override; void focusInEvent(QFocusEvent *event) override;
// QWidget interface
protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
}; };