2
0
forked from Ivasoft/DSView

fix: The label of channel unable to edit in windows,

This commit is contained in:
dreamsourcelabTAI
2024-04-23 11:27:28 +08:00
parent e2e6bbaee1
commit a4993af411
2 changed files with 41 additions and 4 deletions

View File

@@ -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();
}

View File

@@ -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