forked from Ivasoft/DSView
fix: The label of channel unable to edit in windows,
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user