From a4993af41136f6667f3c40b8f6014330c5b0b7ee Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 23 Apr 2024 11:27:28 +0800 Subject: [PATCH] fix: The label of channel unable to edit in windows, --- DSView/pv/dock/keywordlineedit.cpp | 26 ++++++++++++++++++++++++-- DSView/pv/dock/keywordlineedit.h | 19 +++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/DSView/pv/dock/keywordlineedit.cpp b/DSView/pv/dock/keywordlineedit.cpp index ef6562f9..6c373a07 100644 --- a/DSView/pv/dock/keywordlineedit.cpp +++ b/DSView/pv/dock/keywordlineedit.cpp @@ -165,7 +165,9 @@ void PopupLineEditInput::Popup(QWidget *editline) PopupLineEdit::PopupLineEdit(const QString &text, QWidget *parent) :QLineEdit(text, parent) { - _is_number_mode = false; + _is_number_mode = false; + _is_instant = false; + _popup_input = NULL; } void PopupLineEdit::mousePressEvent(QMouseEvent *event) @@ -217,7 +219,7 @@ void PopupLineEdit::onPopupInputEditEnd(QString text) } } -bool PopupLineEdit::set_number_mode(bool isNumberMode) +void PopupLineEdit::set_number_mode(bool isNumberMode) { _is_number_mode = isNumberMode; @@ -244,4 +246,24 @@ int PopupLineEdit::value() void PopupLineEdit::setValue(int value) { this->setText(QString::number(value)); +} + +void PopupLineEdit::show() +{ + QLineEdit::show(); + +#ifdef _WIN32 + if (_is_instant){ + showPupopInput(); + } +#endif +} + +void PopupLineEdit::hide() +{ + if (_popup_input != NULL){ + _popup_input->input_close(); + } + + QLineEdit::hide(); } \ No newline at end of file diff --git a/DSView/pv/dock/keywordlineedit.h b/DSView/pv/dock/keywordlineedit.h index 6516d6bb..7f68da84 100644 --- a/DSView/pv/dock/keywordlineedit.h +++ b/DSView/pv/dock/keywordlineedit.h @@ -67,6 +67,10 @@ public: return _textInput; } + inline void input_close(){ + InputRelease(); + } + signals: void sig_inputEnd(QString text); @@ -95,11 +99,20 @@ public: return _is_number_mode; } - bool set_number_mode(bool isNumberMode); + void set_number_mode(bool isNumberMode); + + inline bool is_instant_mode(){ + return _is_instant; + } + + inline void set_instant_mode(bool isInstant){ + _is_instant = isInstant; + } int value(); - void setValue(int value); + void show(); + void hide(); protected: void mousePressEvent(QMouseEvent *event) override; @@ -113,6 +126,8 @@ private: private: QString _old_text; bool _is_number_mode; + bool _is_instant; + PopupLineEditInput *_popup_input; }; #endif