void AssignHotKey_Test::keyPressEventOnlyModifiers() { AssignHotKey ahk(NULL); bool autoclose = ahk.m_autoCloseCheckBox->isChecked(); ahk.m_autoCloseCheckBox->setChecked(false); QKeyEvent ev(QEvent::KeyPress, Qt::Key_Shift, Qt::ShiftModifier); ahk.keyPressEvent(&ev); QCOMPARE(ahk.keySequence(), QKeySequence()); QCOMPARE(ahk.result(), (int) QDialog::Rejected); ev = QKeyEvent(QEvent::KeyPress, Qt::Key_Control, Qt::ControlModifier); ahk.keyPressEvent(&ev); QCOMPARE(ahk.keySequence(), QKeySequence()); QCOMPARE(ahk.result(), (int) QDialog::Rejected); ev = QKeyEvent(QEvent::KeyPress, Qt::Key_Alt, Qt::AltModifier); ahk.keyPressEvent(&ev); QCOMPARE(ahk.keySequence(), QKeySequence()); QCOMPARE(ahk.result(), (int) QDialog::Rejected); ev = QKeyEvent(QEvent::KeyPress, Qt::Key_Meta, Qt::MetaModifier); ahk.keyPressEvent(&ev); QCOMPARE(ahk.keySequence(), QKeySequence()); QCOMPARE(ahk.result(), (int) QDialog::Rejected); // Reset autoclose ahk.m_autoCloseCheckBox->setChecked(autoclose); }
void AssignHotKey_Test::initial() { QKeySequence seq(Qt::Key_A | Qt::SHIFT); AssignHotKey ahk(NULL, seq); QCOMPARE(ahk.keySequence(), seq); QCOMPARE(ahk.m_previewEdit->text(), seq.toString(QKeySequence::NativeText)); QCOMPARE(ahk.m_previewEdit->isReadOnly(), true); }
void InputSelectionWidget::slotAttachKey() { AssignHotKey ahk(this, m_keySequence); if (ahk.exec() == QDialog::Accepted) { setKeySequence(QKeySequence(ahk.keySequence())); emit keySequenceChanged(m_keySequence); } }
void VCCueListProperties::slotPlaybackAttachClicked() { AssignHotKey ahk(this, m_playbackKeySequence); if (ahk.exec() == QDialog::Accepted) { m_playbackKeySequence = QKeySequence(ahk.keySequence()); m_playbackKeyEdit->setText(m_playbackKeySequence.toString(QKeySequence::NativeText)); } }
void VCButtonProperties::slotAttachKey() { AssignHotKey ahk(this, m_keySequence); if (ahk.exec() == QDialog::Accepted) { m_keySequence = QKeySequence(ahk.keySequence()); m_keyEdit->setText(m_keySequence.toString(QKeySequence::NativeText)); } }
void AssignHotKey_Test::keyPressEventNoAuto() { AssignHotKey ahk(NULL); bool autoclose = ahk.m_autoCloseCheckBox->isChecked(); // Autoclose off ahk.m_autoCloseCheckBox->setChecked(false); QKeyEvent ev(QEvent::KeyPress, Qt::Key_B, Qt::ShiftModifier); QCOMPARE(ahk.result(), (int) QDialog::Rejected); ahk.keyPressEvent(&ev); QCOMPARE(ahk.result(), (int) QDialog::Rejected); QCOMPARE(ahk.keySequence(), QKeySequence(Qt::Key_B | Qt::SHIFT)); // Reset autoclose ahk.m_autoCloseCheckBox->setChecked(autoclose); }