mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix 2874
when losing focus circle gets renamed unless ESC is pressed
This commit is contained in:
parent
e5e4d561c9
commit
04b3276b0f
|
@ -40,8 +40,10 @@ CroppingLabel::CroppingLabel(QWidget* parent)
|
|||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
undo();
|
||||
clearFocus();
|
||||
}
|
||||
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
|
@ -53,8 +55,7 @@ CroppingLabel::CroppingLabel(QWidget* parent)
|
|||
| Qt::ImhNoPredictiveText
|
||||
| Qt::ImhPreferLatin);
|
||||
|
||||
connect(textEdit, &QLineEdit::returnPressed, this, &CroppingLabel::editingFinished);
|
||||
connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::hideTextEdit);
|
||||
connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished);
|
||||
}
|
||||
|
||||
void CroppingLabel::editBegin()
|
||||
|
@ -162,6 +163,7 @@ void CroppingLabel::minimizeMaximumWidth()
|
|||
|
||||
void CroppingLabel::editingFinished()
|
||||
{
|
||||
hideTextEdit();
|
||||
QString newText = textEdit->text().trimmed().remove(QRegExp("[\\t\\n\\v\\f\\r\\x0000]"));
|
||||
|
||||
if (origText != newText)
|
||||
|
|
Loading…
Reference in New Issue
Block a user