#include <qshortcutmap_p.h>
Collaboration diagram for QShortcutMap:

Definition at line 53 of file qshortcutmap_p.h.
| QShortcutMap::QShortcutMap | ( | ) |
Definition at line 123 of file qshortcutmap.cpp.
References d_ptr, and resetState().
00124 { 00125 d_ptr = new QShortcutMapPrivate(this); 00126 Q_ASSERT(d_ptr != 0); 00127 resetState(); 00128 }
Here is the call graph for this function:

| QShortcutMap::~QShortcutMap | ( | ) |
| int QShortcutMap::addShortcut | ( | QObject * | owner, | |
| const QKeySequence & | key, | |||
| Qt::ShortcutContext | context | |||
| ) |
Definition at line 143 of file qshortcutmap.cpp.
References d, key, QDebug::nospace(), owner, qDebug(), and qUpperBound().
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), and QActionPrivate::redoGrabAlternate().
00144 { 00145 Q_ASSERT_X(owner, "QShortcutMap::addShortcut", "All shortcuts need an owner"); 00146 Q_ASSERT_X(!key.isEmpty(), "QShortcutMap::addShortcut", "Cannot add keyless shortcuts to map"); 00147 Q_D(QShortcutMap); 00148 00149 QShortcutEntry newEntry(owner, key, context, --(d->currentId), true); 00150 QList<QShortcutEntry>::iterator it = qUpperBound(d->sequences.begin(), d->sequences.end(), newEntry); 00151 d->sequences.insert(it, newEntry); // Insert sorted 00152 #if defined(DEBUG_QSHORTCUTMAP) 00153 qDebug().nospace() 00154 << "QShortcutMap::addShortcut(" << owner << ", " 00155 << key << ", " << context << ") = " << d->currentId; 00156 #endif 00157 return d->currentId; 00158 }
Here is the call graph for this function:

| int QShortcutMap::removeShortcut | ( | int | id, | |
| QObject * | owner, | |||
| const QKeySequence & | key = QKeySequence() | |||
| ) |
Definition at line 169 of file qshortcutmap.cpp.
References d, i, QShortcutEntry::id, key, QShortcutEntry::keyseq, QDebug::nospace(), owner, QShortcutEntry::owner, and qDebug().
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), and QActionPrivate::redoGrabAlternate().
00170 { 00171 Q_D(QShortcutMap); 00172 int itemsRemoved = 0; 00173 bool allOwners = (owner == 0); 00174 bool allKeys = key.isEmpty(); 00175 bool allIds = id == 0; 00176 00177 // Special case, remove everything 00178 if (allOwners && allKeys && id == 0) { 00179 itemsRemoved = d->sequences.size(); 00180 d->sequences.clear(); 00181 return itemsRemoved; 00182 } 00183 00184 int i = d->sequences.size()-1; 00185 while (i>=0) 00186 { 00187 const QShortcutEntry &entry = d->sequences.at(i); 00188 int entryId = entry.id; 00189 if ((allOwners || entry.owner == owner) 00190 && (allIds || entry.id == id) 00191 && (allKeys || entry.keyseq == key)) { 00192 d->sequences.removeAt(i); 00193 ++itemsRemoved; 00194 } 00195 if (id == entryId) 00196 return itemsRemoved; 00197 --i; 00198 } 00199 #if defined(DEBUG_QSHORTCUTMAP) 00200 qDebug().nospace() 00201 << "QShortcutMap::removeShortcut(" << id << ", " << owner << ", " 00202 << key << ") = " << itemsRemoved; 00203 #endif 00204 return itemsRemoved; 00205 }
Here is the call graph for this function:

| int QShortcutMap::setShortcutEnabled | ( | bool | enable, | |
| int | id, | |||
| QObject * | owner, | |||
| const QKeySequence & | key = QKeySequence() | |||
| ) |
Definition at line 215 of file qshortcutmap.cpp.
References d, i, QShortcutEntry::id, key, QShortcutEntry::keyseq, QDebug::nospace(), owner, QShortcutEntry::owner, and qDebug().
Referenced by QActionPrivate::redoGrab(), QShortcutPrivate::redoGrab(), QActionPrivate::redoGrabAlternate(), and QActionPrivate::setShortcutEnabled().
00216 { 00217 Q_D(QShortcutMap); 00218 int itemsChanged = 0; 00219 bool allOwners = (owner == 0); 00220 bool allKeys = key.isEmpty(); 00221 bool allIds = id == 0; 00222 00223 int i = d->sequences.size()-1; 00224 while (i>=0) 00225 { 00226 QShortcutEntry entry = d->sequences.at(i); 00227 if ((allOwners || entry.owner == owner) 00228 && (allIds || entry.id == id) 00229 && (allKeys || entry.keyseq == key)) { 00230 d->sequences[i].enabled = enable; 00231 ++itemsChanged; 00232 } 00233 if (id == entry.id) 00234 return itemsChanged; 00235 --i; 00236 } 00237 #if defined(DEBUG_QSHORTCUTMAP) 00238 qDebug().nospace() 00239 << "QShortcutMap::setShortcutEnabled(" << enable << ", " << id << ", " 00240 << owner << ", " << key << ") = " << itemsChanged; 00241 #endif 00242 return itemsChanged; 00243 }
Here is the call graph for this function:

| int QShortcutMap::setShortcutAutoRepeat | ( | bool | on, | |
| int | id, | |||
| QObject * | owner, | |||
| const QKeySequence & | key = QKeySequence() | |||
| ) |
Definition at line 253 of file qshortcutmap.cpp.
References d, i, QShortcutEntry::id, key, QShortcutEntry::keyseq, QDebug::nospace(), owner, QShortcutEntry::owner, and qDebug().
Referenced by QActionPrivate::redoGrab(), and QShortcutPrivate::redoGrab().
00254 { 00255 Q_D(QShortcutMap); 00256 int itemsChanged = 0; 00257 bool allOwners = (owner == 0); 00258 bool allKeys = key.isEmpty(); 00259 bool allIds = id == 0; 00260 00261 int i = d->sequences.size()-1; 00262 while (i>=0) 00263 { 00264 QShortcutEntry entry = d->sequences.at(i); 00265 if ((allOwners || entry.owner == owner) 00266 && (allIds || entry.id == id) 00267 && (allKeys || entry.keyseq == key)) { 00268 d->sequences[i].autorepeat = on; 00269 ++itemsChanged; 00270 } 00271 if (id == entry.id) 00272 return itemsChanged; 00273 --i; 00274 } 00275 #if defined(DEBUG_QSHORTCUTMAP) 00276 qDebug().nospace() 00277 << "QShortcutMap::setShortcutAutoRepeat(" << on << ", " << id << ", " 00278 << owner << ", " << key << ") = " << itemsChanged; 00279 #endif 00280 return itemsChanged; 00281 }
Here is the call graph for this function:

| void QShortcutMap::resetState | ( | ) |
Definition at line 286 of file qshortcutmap.cpp.
References clearSequence(), d, and QKeySequence::NoMatch.
Referenced by QShortcutMap(), and tryShortcutEvent().
00287 { 00288 Q_D(QShortcutMap); 00289 d->currentState = QKeySequence::NoMatch; 00290 clearSequence(d->currentSequences); 00291 }
Here is the call graph for this function:

| QKeySequence::SequenceMatch QShortcutMap::nextState | ( | QKeyEvent * | e | ) |
Definition at line 355 of file qshortcutmap.cpp.
References QEvent::accept(), clearSequence(), d, QKeySequence::ExactMatch, find(), QKeyEvent::key(), Qt::Key_Alt, Qt::Key_Backtab, Qt::Key_Shift, Qt::Key_Tab, QKeyEvent::modifiers(), QKeySequence::NoMatch, QDebug::nospace(), QKeySequence::PartialMatch, qDebug(), Qt::ShiftModifier, QKeyEvent::text(), and QEvent::type().
Referenced by tryShortcutEvent().
00356 { 00357 Q_D(QShortcutMap); 00358 // Modifiers can NOT be shortcuts... 00359 if (e->key() >= Qt::Key_Shift && 00360 e->key() <= Qt::Key_Alt) 00361 return d->currentState; 00362 00363 QKeySequence::SequenceMatch result = QKeySequence::NoMatch; 00364 00365 // We start fresh each time.. 00366 d->identicals.resize(0); 00367 00368 result = find(e); 00369 if (result == QKeySequence::NoMatch && e->modifiers() & Qt::ShiftModifier) { 00370 // If Shift + Key_Backtab, also try Shift + Qt::Key_Tab 00371 if (e->key() == Qt::Key_Backtab) { 00372 QKeyEvent pe = QKeyEvent(e->type(), Qt::Key_Tab, e->modifiers(), e->text()); 00373 result = find(&pe); 00374 } 00375 #if 0 00376 // ### This is not needed anymore, kill it when qkeymapper is done... 00377 // If still no result, try removing the Shift modifier 00378 if (result == QKeySequence::NoMatch) { 00379 QKeyEvent pe = QKeyEvent(e->type(), e->key(), 00380 e->modifiers()&~Qt::ShiftModifier, e->text()); 00381 result = find(&pe); 00382 } 00383 #endif 00384 } 00385 00386 // Should we eat this key press? 00387 if (d->currentState == QKeySequence::PartialMatch 00388 || (d->currentState == QKeySequence::ExactMatch && d->identicals.count())) 00389 e->accept(); 00390 // Does the new state require us to clean up? 00391 if (result == QKeySequence::NoMatch) 00392 clearSequence(d->currentSequences); 00393 d->currentState = result; 00394 00395 #if defined(DEBUG_QSHORTCUTMAP) 00396 qDebug().nospace() << "QShortcutMap::nextState(" << e << ") = " << result; 00397 #endif 00398 return result; 00399 }
Here is the call graph for this function:

| QKeySequence::SequenceMatch QShortcutMap::state | ( | ) |
Definition at line 296 of file qshortcutmap.cpp.
References d.
00297 { 00298 Q_D(QShortcutMap); 00299 return d->currentState; 00300 }
| void QShortcutMap::dispatchEvent | ( | QKeyEvent * | e | ) |
Definition at line 709 of file qshortcutmap.cpp.
References d, QShortcutEntry::enabled, i, QKeyEvent::isAutoRepeat(), next, QDebug::nospace(), qDebug(), and QCoreApplication::sendEvent().
Referenced by tryShortcutEvent().
00710 { 00711 Q_D(QShortcutMap); 00712 if (!d->identicals.size()) 00713 return; 00714 00715 const QKeySequence &curKey = d->identicals.at(0)->keyseq; 00716 if (d->prevSequence != curKey) { 00717 d->ambigCount = 0; 00718 d->prevSequence = curKey; 00719 } 00720 // Find next 00721 const QShortcutEntry *current = 0, *next = 0; 00722 int i = 0, enabledShortcuts = 0; 00723 while(i < d->identicals.size()) { 00724 current = d->identicals.at(i); 00725 if (current->enabled || !next){ 00726 ++enabledShortcuts; 00727 if (enabledShortcuts > d->ambigCount + 1) 00728 break; 00729 next = current; 00730 } 00731 ++i; 00732 } 00733 d->ambigCount = (d->identicals.size() == i ? 0 : d->ambigCount + 1); 00734 // Don't trigger shortcut if we're autorepeating and the shortcut is 00735 // grabbed with not accepting autorepeats. 00736 if (!next || (e->isAutoRepeat() && !next->autorepeat)) 00737 return; 00738 // Dispatch next enabled 00739 #if defined(DEBUG_QSHORTCUTMAP) 00740 qDebug().nospace() 00741 << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\"" 00742 << (QString)next->keyseq << "\", " << next->id << ", " 00743 << (bool)(enabledShortcuts>1) << ") to object(" << next->owner << ")"; 00744 #endif 00745 QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1); 00746 QApplication::sendEvent(const_cast<QObject *>(next->owner), &se); 00747 }
Here is the call graph for this function:

Definition at line 308 of file qshortcutmap.cpp.
References QEvent::accept(), d, dispatchEvent(), QKeySequence::ExactMatch, QEvent::ignore(), QEvent::isAccepted(), nextState(), QKeySequence::NoMatch, QKeySequence::PartialMatch, resetState(), QCoreApplication::sendSpontaneousEvent(), QEvent::ShortcutOverride, QEvent::t, and w.
00309 { 00310 Q_D(QShortcutMap); 00311 00312 bool wasAccepted = e->isAccepted(); 00313 if (d->currentState == QKeySequence::NoMatch) { 00314 ushort orgType = e->t; 00315 e->t = QEvent::ShortcutOverride; 00316 e->ignore(); 00317 QApplication::sendSpontaneousEvent(w, e); 00318 e->t = orgType; 00319 if (e->isAccepted()) { 00320 if (!wasAccepted) 00321 e->ignore(); 00322 return false; 00323 } 00324 } 00325 00326 QKeySequence::SequenceMatch result = nextState(e); 00327 bool stateWasAccepted = e->isAccepted(); 00328 if (wasAccepted) 00329 e->accept(); 00330 else 00331 e->ignore(); 00332 00333 int identicalMatches = d->identicals.count(); 00334 00335 switch(result) { 00336 case QKeySequence::NoMatch: 00337 return stateWasAccepted; 00338 case QKeySequence::ExactMatch: 00339 resetState(); 00340 dispatchEvent(e); 00341 default: 00342 break; 00343 } 00344 // If nextState is QKeySequence::ExactMatch && identicals.count == 0 00345 // we've only found disabled shortcuts 00346 return identicalMatches > 0 || result == QKeySequence::PartialMatch; 00347 }
Here is the call graph for this function:

| bool QShortcutMap::correctContext | ( | Qt::ShortcutContext | context, | |
| QWidget * | w, | |||
| QWidget * | active_window | |||
| ) | [private] |
Definition at line 616 of file qshortcutmap.cpp.
References Qt::ApplicationShortcut, QApplication::focusWidget(), QWidget::isWindow(), QDebug::nospace(), QWidget::parentWidget(), qDebug(), Qt::SubWindow, Qt::Tool, QApplicationPrivate::tryModalHelper(), w, Qt::WidgetShortcut, QWidget::window(), and QWidget::windowType().
Referenced by correctContext(), and find().
00617 { 00618 if (!w->isVisible() || !w->isEnabled()) 00619 return false; 00620 00621 if (context == Qt::ApplicationShortcut) 00622 return QApplicationPrivate::tryModalHelper(w, 0); // true, unless w is shadowed by a modal dialog 00623 00624 if (context == Qt::WidgetShortcut) 00625 return w == QApplication::focusWidget(); 00626 00627 QWidget *tlw = w->window(); 00628 00629 /* if a floating tool window is active, keep shortcuts on the 00630 * parent working */ 00631 if (active_window != tlw && active_window && active_window->windowType() == Qt::Tool && active_window->parentWidget()) { 00632 active_window = active_window->parentWidget()->window(); 00633 } 00634 00635 if (active_window != tlw) 00636 return false; 00637 00638 /* if we live in a MDI subwindow, ignore the event if we are 00639 not the active document window */ 00640 const QWidget* sw = w; 00641 while (sw && !(sw->windowType() == Qt::SubWindow) && !sw->isWindow()) 00642 sw = sw->parentWidget(); 00643 if (sw && (sw->windowType() == Qt::SubWindow)) { 00644 QWidget *focus_widget = QApplication::focusWidget(); 00645 while (focus_widget && focus_widget != sw) 00646 focus_widget = focus_widget->parentWidget(); 00647 return sw == focus_widget; 00648 } 00649 00650 #if defined(DEBUG_QSHORTCUTMAP) 00651 qDebug().nospace() << "..true [Pass-through]"; 00652 #endif 00653 return true; 00654 }
Here is the call graph for this function:

| bool QShortcutMap::correctContext | ( | Qt::ShortcutContext | context, | |
| QAction * | a, | |||
| QWidget * | active_window | |||
| ) | [private] |
Definition at line 657 of file qshortcutmap.cpp.
References a, QList< T >::at(), correctContext(), i, QList< T >::isEmpty(), qDebug(), QList< T >::size(), and w.
00658 { 00659 const QList<QWidget *> &widgets = a->d_func()->widgets; 00660 #if defined(DEBUG_QSHORTCUTMAP) 00661 if (widgets.isEmpty()) 00662 qDebug() << a << "not connected to any widgets; won't trigger"; 00663 #endif 00664 for (int i = 0; i < widgets.size(); ++i) { 00665 QWidget *w = widgets.at(i); 00666 #ifndef QT_NO_MENU 00667 if (QMenu *menu = qobject_cast<QMenu *>(w)) { 00668 QAction *a = menu->menuAction(); 00669 if (correctContext(context, a, active_window)) 00670 return true; 00671 } else 00672 #endif 00673 if (correctContext(context, w, active_window)) 00674 return true; 00675 } 00676 return false; 00677 }
Here is the call graph for this function:

| QKeySequence::SequenceMatch QShortcutMap::find | ( | QKeyEvent * | e | ) | [private] |
Definition at line 408 of file qshortcutmap.cpp.
References QVector< T >::at(), QVector< T >::clear(), clearSequence(), correctContext(), QVector< T >::count(), createNewSequences(), d, QKeySequence::ExactMatch, i, QKeyEvent::key(), Qt::Key_unknown, QString::length(), matches(), QKeySequence::NoMatch, QKeySequence::PartialMatch, qDebug(), qLowerBound(), qMax(), and QKeyEvent::text().
Referenced by nextState().
00409 { 00410 Q_D(QShortcutMap); 00411 if (!d->sequences.count()) 00412 return QKeySequence::NoMatch; 00413 00414 static QVector<QKeySequence> newEntries; 00415 createNewSequences(e, newEntries); 00416 #if defined(DEBUG_QSHORTCUTMAP) 00417 qDebug() << "Possible shortcut keysequences:" << newEntries; 00418 #endif 00419 00420 // Should never happen 00421 if (newEntries == d->currentSequences) { 00422 Q_ASSERT_X(e->key() != Qt::Key_unknown || e->text().length(), 00423 "QShortcutMap::find", "New sequence to find identical to previous"); 00424 return QKeySequence::NoMatch; 00425 } 00426 00427 // Looking for new identicals, scrap old 00428 d->identicals.resize(0); 00429 00430 bool partialFound = false; 00431 bool identicalDisabledFound = false; 00432 QVector<QKeySequence> okEntries; 00433 int result = QKeySequence::NoMatch; 00434 for (int i = newEntries.count()-1; i >= 0 ; --i) { 00435 QShortcutEntry entry(newEntries.at(i)); // needed for searching 00436 QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd(); 00437 QList<QShortcutEntry>::ConstIterator it = 00438 qLowerBound(d->sequences.constBegin(), itEnd, entry); 00439 00440 int oneKSResult = QKeySequence::NoMatch; 00441 int tempRes = QKeySequence::NoMatch; 00442 do { 00443 if (it == itEnd) 00444 break; 00445 tempRes = matches(entry.keyseq, (*it).keyseq); 00446 oneKSResult = qMax(oneKSResult, tempRes); 00447 if (tempRes != QKeySequence::NoMatch && correctContext(*it)) { 00448 if (tempRes == QKeySequence::ExactMatch) { 00449 if ((*it).enabled) 00450 d->identicals.append(&*it); 00451 else 00452 identicalDisabledFound = true; 00453 } else if (tempRes == QKeySequence::PartialMatch) { 00454 // We don't need partials, if we have identicals 00455 if (d->identicals.size()) 00456 break; 00457 // We only care about enabled partials, so we don't consume 00458 // key events when all partials are disabled! 00459 partialFound |= (*it).enabled; 00460 } 00461 } 00462 ++it; 00463 // If we got a valid match on this run, there might still be more keys to check against, 00464 // so we'll loop once more. If we get NoMatch, there's guaranteed no more possible 00465 // matches in the shortcutmap. 00466 } while (tempRes != QKeySequence::NoMatch); 00467 00468 // If the type of match improves (ergo, NoMatch->Partial, or Partial->Exact), clear the 00469 // previous list. If this match is equal or better than the last match, append to the list 00470 if (oneKSResult > result) { 00471 okEntries.clear(); 00472 #if defined(DEBUG_QSHORTCUTMAP) 00473 qDebug() << "Found better match (" << newEntries << "), clearing keysequence list"; 00474 #endif 00475 } 00476 if (oneKSResult && oneKSResult >= result) { 00477 okEntries << newEntries.at(i); 00478 #if defined(DEBUG_QSHORTCUTMAP) 00479 qDebug() << "Added ok keysequence" << newEntries; 00480 #endif 00481 } 00482 } 00483 00484 if (d->identicals.size()) { 00485 result = QKeySequence::ExactMatch; 00486 } else if (partialFound) { 00487 result = QKeySequence::PartialMatch; 00488 } else if (identicalDisabledFound) { 00489 result = QKeySequence::ExactMatch; 00490 } else { 00491 clearSequence(d->currentSequences); 00492 result = QKeySequence::NoMatch; 00493 } 00494 if (result != QKeySequence::NoMatch) 00495 d->currentSequences = okEntries; 00496 #if defined(DEBUG_QSHORTCUTMAP) 00497 qDebug() << "Returning shortcut match == " << result; 00498 #endif 00499 return QKeySequence::SequenceMatch(result); 00500 }
Here is the call graph for this function:

| QKeySequence::SequenceMatch QShortcutMap::matches | ( | const QKeySequence & | seq1, | |
| const QKeySequence & | seq2 | |||
| ) | const [private] |
Definition at line 559 of file qshortcutmap.cpp.
References QKeySequence::count(), QKeySequence::ExactMatch, i, Qt::Key_hyphen, Qt::Key_Minus, Qt::Key_unknown, Qt::KeyboardModifierMask, match(), QKeySequence::NoMatch, and QKeySequence::PartialMatch.
00561 { 00562 uint userN = seq1.count(), 00563 seqN = seq2.count(); 00564 00565 if (userN > seqN) 00566 return QKeySequence::NoMatch; 00567 00568 // If equal in length, we have a potential ExactMatch sequence, 00569 // else we already know it can only be partial. 00570 QKeySequence::SequenceMatch match = (userN == seqN 00571 ? QKeySequence::ExactMatch 00572 : QKeySequence::PartialMatch); 00573 00574 for (uint i = 0; i < userN; ++i) { 00575 int userKey = seq1[i], 00576 sequenceKey = seq2[i]; 00577 if ((userKey & Qt::Key_unknown) == Qt::Key_hyphen) 00578 userKey = userKey & Qt::KeyboardModifierMask | Qt::Key_Minus; 00579 if ((sequenceKey & Qt::Key_unknown) == Qt::Key_hyphen) 00580 sequenceKey = sequenceKey & Qt::KeyboardModifierMask | Qt::Key_Minus; 00581 if (userKey != sequenceKey) 00582 return QKeySequence::NoMatch; 00583 } 00584 return match; 00585 }
Here is the call graph for this function:

| QVector< const QShortcutEntry * > QShortcutMap::matches | ( | ) | const [private] |
Definition at line 700 of file qshortcutmap.cpp.
References d.
Referenced by find().
00701 { 00702 Q_D(const QShortcutMap); 00703 return d->identicals; 00704 }
| void QShortcutMap::createNewSequences | ( | QKeyEvent * | e, | |
| QVector< QKeySequence > & | ksl | |||
| ) | [private] |
Definition at line 518 of file qshortcutmap.cpp.
References QList< T >::at(), QList< T >::count(), d, i, index, QKeyMapper::possibleKeys(), qMax(), QVector< T >::resize(), and QKeySequence::setKey().
Referenced by find().
00519 { 00520 Q_D(QShortcutMap); 00521 QList<int> possibleKeys = QKeyMapper::possibleKeys(e); 00522 int pkTotal = possibleKeys.count(); 00523 if (!pkTotal) 00524 return; 00525 00526 int ssActual = d->currentSequences.count(); 00527 int ssTotal = qMax(1, ssActual); 00528 // Resize to possible permutations of the current sequence(s). 00529 ksl.resize(pkTotal * ssTotal); 00530 00531 int index = ssActual ? d->currentSequences.at(0).count() : 0; 00532 for (int pkNum = 0; pkNum < pkTotal; ++pkNum) { 00533 for (int ssNum = 0; ssNum < ssTotal; ++ssNum) { 00534 int i = (pkNum * ssTotal) + ssNum; 00535 QKeySequence &curKsl = ksl[i]; 00536 if (ssActual) { 00537 const QKeySequence &curSeq = d->currentSequences.at(ssNum); 00538 curKsl.setKey(curSeq[0], 0); 00539 curKsl.setKey(curSeq[1], 1); 00540 curKsl.setKey(curSeq[2], 2); 00541 curKsl.setKey(curSeq[3], 3); 00542 } else { 00543 curKsl.setKey(0, 0); 00544 curKsl.setKey(0, 1); 00545 curKsl.setKey(0, 2); 00546 curKsl.setKey(0, 3); 00547 } 00548 // Filtering keycode here with 0xdfffffff to ignore the Keypad modifier 00549 curKsl.setKey(possibleKeys.at(pkNum) & 0xdfffffff, index); 00550 } 00551 } 00552 }
Here is the call graph for this function:

| void QShortcutMap::clearSequence | ( | QVector< QKeySequence > & | ksl | ) | [private] |
Definition at line 509 of file qshortcutmap.cpp.
References QVector< T >::clear().
Referenced by find(), nextState(), and resetState().
00510 { 00511 ksl.clear(); 00512 }
Here is the call graph for this function:

| bool QShortcutMap::correctContext | ( | const QShortcutEntry & | item | ) | [private] |
Definition at line 591 of file qshortcutmap.cpp.
References a, QShortcutEntry::context, correctContext(), QShortcutEntry::owner, qApp, qobject_cast< QWidget * >(), s, and w.
00591 { 00592 Q_ASSERT_X(item.owner, "QShortcutMap", "Shortcut has no owner. Illegal map state!"); 00593 00594 QWidget *active_window = qApp->activeWindow(); 00595 00596 // popups do not become the active window, 00597 // so we fake it here to get the correct context 00598 // for the shortcut system. 00599 if (qApp->activePopupWidget()) 00600 active_window = qApp->activePopupWidget(); 00601 00602 if (!active_window) 00603 return false; 00604 #ifndef QT_NO_ACTION 00605 if (QAction *a = qobject_cast<QAction *>(item.owner)) 00606 return correctContext(item.context, a, active_window); 00607 #endif 00608 QWidget *w = qobject_cast<QWidget *>(item.owner); 00609 if (!w) { 00610 QShortcut *s = qobject_cast<QShortcut *>(item.owner); 00611 w = s->parentWidget(); 00612 } 00613 return correctContext(item.context, w, active_window); 00614 }
Here is the call graph for this function:

| int QShortcutMap::translateModifiers | ( | Qt::KeyboardModifiers | modifiers | ) | [private] |
Definition at line 683 of file qshortcutmap.cpp.
References Qt::ALT, Qt::AltModifier, Qt::ControlModifier, Qt::CTRL, Qt::META, Qt::MetaModifier, Qt::SHIFT, and Qt::ShiftModifier.
00684 { 00685 int result = 0; 00686 if (modifiers & Qt::ShiftModifier) 00687 result |= Qt::SHIFT; 00688 if (modifiers & Qt::ControlModifier) 00689 result |= Qt::CTRL; 00690 if (modifiers & Qt::MetaModifier) 00691 result |= Qt::META; 00692 if (modifiers & Qt::AltModifier) 00693 result |= Qt::ALT; 00694 return result; 00695 }
QShortcutMapPrivate* QShortcutMap::d_ptr [private] |
1.5.1