예제 #1
0
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);
}
예제 #2
0
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);
}
예제 #3
0
void InputSelectionWidget::slotAttachKey()
{
    AssignHotKey ahk(this, m_keySequence);
    if (ahk.exec() == QDialog::Accepted)
    {
        setKeySequence(QKeySequence(ahk.keySequence()));
        emit keySequenceChanged(m_keySequence);
    }
}
예제 #4
0
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));
    }
}
예제 #5
0
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));
    }
}
예제 #6
0
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);
}