diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 461d8ff992..d60fada5f4 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -365,10 +365,17 @@ void ActionSelector::on_downButton_clicked() AccelLineEdit::AccelLineEdit ( QWidget * parent ) : QLineEdit(parent) { - setText(tr("none")); + noneStr = tr("none"); + setText(noneStr); keyPressedCount = 0; } +bool AccelLineEdit::isNone() const +{ + QString t = text(); + return t.isEmpty() || t == noneStr; +} + /** * Checks which keys are pressed and show it as text. */ @@ -386,7 +393,7 @@ void AccelLineEdit::keyPressEvent ( QKeyEvent * e) case Qt::Key_Backspace: if (state == Qt::NoModifier) { keyPressedCount = 0; - setText(tr("none")); + setText(noneStr); } case Qt::Key_Control: case Qt::Key_Shift: diff --git a/src/Gui/Widgets.h b/src/Gui/Widgets.h index 5a4c803402..e14b055ae5 100644 --- a/src/Gui/Widgets.h +++ b/src/Gui/Widgets.h @@ -124,13 +124,15 @@ class GuiExport AccelLineEdit : public QLineEdit Q_OBJECT public: - AccelLineEdit ( QWidget * parent=0 ); + AccelLineEdit(QWidget * parent=0); + bool isNone() const; protected: - void keyPressEvent ( QKeyEvent * e); + void keyPressEvent(QKeyEvent * e); private: - int keyPressedCount; + QString noneStr; + int keyPressedCount; }; // ------------------------------------------------------------------------------