Logo Search packages:      
Sourcecode: qt4-x11 version File versions

Qt::KeyboardModifiers QKeyEvent::modifiers (  )  const

Returns the keyboard modifier flags that existed immediately after the event occurred.

Warning:
This function cannot always be trusted. The user can confuse it by pressing both {Shift} keys simultaneously and releasing one of them, for example.
See also:
QApplication::keyboardModifiers()

Reimplemented from QInputEvent.

Definition at line 769 of file qevent.cpp.

References key(), and QInputEvent::modifiers().

Referenced by QLineEdit::event(), QWidget::event(), QMenuBar::eventFilter(), QCompleter::eventFilter(), QLineEdit::keyPressEvent(), QDialog::keyPressEvent(), QTabWidget::keyPressEvent(), QComboBox::keyPressEvent(), QAbstractSpinBox::keyPressEvent(), QMessageBox::keyPressEvent(), QAbstractItemView::keyPressEvent(), QTextEdit::keyPressEvent(), QMenu::keyPressEvent(), QDateTimeEdit::keyPressEvent(), QMenuBar::keyPressEvent(), QTextBrowser::keyPressEvent(), and matches().

{
    if (key() == Qt::Key_Shift)
        return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
    if (key() == Qt::Key_Control)
        return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
    if (key() == Qt::Key_Alt)
        return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
    if (key() == Qt::Key_Meta)
        return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
    return QInputEvent::modifiers();
}


Generated by  Doxygen 1.6.0   Back to index