#include <QmitkHotkeyLineEdit.h>
Public Member Functions | |
| QmitkHotkeyLineEdit (QWidget *parent=0) | |
| QmitkHotkeyLineEdit (const QKeySequence &_QKeySequence, QWidget *parent=0) | |
| QmitkHotkeyLineEdit (const QString &_QString, QWidget *parent=0) | |
| virtual void | SetKeySequence (const QKeySequence &_QKeySequence) |
| virtual void | SetKeySequence (const QString &_QKeySequenceAsString) |
| virtual QKeySequence | GetKeySequence () |
| virtual QString | GetKeySequenceAsString () |
| bool | Matches (QKeyEvent *event) |
Static Public Attributes | |
| static const std::string | TOOLTIP = "Press any key (combination)" |
Protected Slots | |
| void | LineEditTextChanged (const QString &) |
Protected Member Functions | |
| virtual void | keyPressEvent (QKeyEvent *event) |
| void | Init () |
Protected Attributes | |
| QKeySequence | m_KeySequence |
Definition at line 27 of file QmitkHotkeyLineEdit.h.
| QmitkHotkeyLineEdit::QmitkHotkeyLineEdit | ( | QWidget * | parent = 0 ) |
Definition at line 27 of file QmitkHotkeyLineEdit.cpp.
References Init().
: QLineEdit(parent)
{
this->Init();
//this->setReadOnly(true);
}
| QmitkHotkeyLineEdit::QmitkHotkeyLineEdit | ( | const QKeySequence & | _QKeySequence, |
| QWidget * | parent = 0 |
||
| ) |
Definition at line 34 of file QmitkHotkeyLineEdit.cpp.
References Init(), and SetKeySequence().
: QLineEdit(parent)
{
this->Init();
//this->setReadOnly(true);
this->SetKeySequence(_QKeySequence);
}
| QmitkHotkeyLineEdit::QmitkHotkeyLineEdit | ( | const QString & | _QString, |
| QWidget * | parent = 0 |
||
| ) |
Definition at line 42 of file QmitkHotkeyLineEdit.cpp.
References Init(), and SetKeySequence().
: QLineEdit(parent)
{
this->Init();
//this->setReadOnly(true);
this->SetKeySequence(_QKeySequenceAsString);
}
| QKeySequence QmitkHotkeyLineEdit::GetKeySequence | ( | ) | [virtual] |
Definition at line 81 of file QmitkHotkeyLineEdit.cpp.
References m_KeySequence.
{
return m_KeySequence;
}
| QString QmitkHotkeyLineEdit::GetKeySequenceAsString | ( | ) | [virtual] |
Definition at line 86 of file QmitkHotkeyLineEdit.cpp.
References m_KeySequence.
{
return m_KeySequence.toString();
}
| void QmitkHotkeyLineEdit::Init | ( | ) | [protected] |
Definition at line 50 of file QmitkHotkeyLineEdit.cpp.
References LineEditTextChanged(), and TOOLTIP.
Referenced by QmitkHotkeyLineEdit().
{
this->setToolTip(QString::fromStdString(QmitkHotkeyLineEdit::TOOLTIP));
this->setReadOnly(true);
connect( this, SIGNAL( textChanged(const QString &) ), this,
SLOT( LineEditTextChanged(const QString &) ) );
}
| void QmitkHotkeyLineEdit::keyPressEvent | ( | QKeyEvent * | event ) | [protected, virtual] |
Definition at line 58 of file QmitkHotkeyLineEdit.cpp.
References mitk::Key_unknown, m_KeySequence, and SetKeySequence().
{
if(event->key() == Qt::Key_unknown)
return;
m_KeySequence = QKeySequence(event->modifiers(), event->key());
// if no modifier was pressed the sequence is now empty
if(event->modifiers() == Qt::NoModifier)
m_KeySequence = QKeySequence(event->key());
this->SetKeySequence(m_KeySequence);
}
| void QmitkHotkeyLineEdit::LineEditTextChanged | ( | const QString & | text ) | [protected, slot] |
Definition at line 101 of file QmitkHotkeyLineEdit.cpp.
References m_KeySequence.
Referenced by Init().
{
m_KeySequence = QKeySequence(text.toUpper());
}
| bool QmitkHotkeyLineEdit::Matches | ( | QKeyEvent * | event ) |
Definition at line 91 of file QmitkHotkeyLineEdit.cpp.
References m_KeySequence.
{
QKeySequence _KeySequence = QKeySequence(event->modifiers(), event->key());
// if no modifier was pressed the sequence is now empty
if(event->modifiers() == Qt::NoModifier)
_KeySequence = QKeySequence(event->key());
return _KeySequence == m_KeySequence;
}
| void QmitkHotkeyLineEdit::SetKeySequence | ( | const QKeySequence & | _QKeySequence ) | [virtual] |
Definition at line 71 of file QmitkHotkeyLineEdit.cpp.
Referenced by keyPressEvent(), QmitkHotkeyLineEdit(), and SetKeySequence().
{
this->setText(_QKeySequence.toString());
}
| void QmitkHotkeyLineEdit::SetKeySequence | ( | const QString & | _QKeySequenceAsString ) | [virtual] |
Definition at line 76 of file QmitkHotkeyLineEdit.cpp.
References SetKeySequence().
{
this->SetKeySequence(QKeySequence(_QKeySequenceAsString));
}
QKeySequence QmitkHotkeyLineEdit::m_KeySequence [protected] |
Definition at line 49 of file QmitkHotkeyLineEdit.h.
Referenced by GetKeySequence(), GetKeySequenceAsString(), keyPressEvent(), LineEditTextChanged(), and Matches().
const std::string QmitkHotkeyLineEdit::TOOLTIP = "Press any key (combination)" [static] |
Definition at line 32 of file QmitkHotkeyLineEdit.h.
Referenced by Init().
1.7.2