add method to check if key sequence is none
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user