本文整理汇总了C++中KShortcut::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ KShortcut::isEmpty方法的具体用法?C++ KShortcut::isEmpty怎么用?C++ KShortcut::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KShortcut
的用法示例。
在下文中一共展示了KShortcut::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setKeyBinding
bool KCompletionBase::setKeyBinding( KeyBindingType item, const KShortcut& cut )
{
if ( d->m_delegate )
return d->m_delegate->setKeyBinding( item, cut );
if( !cut.isEmpty() )
{
for( KeyBindingMap::Iterator it = d->m_keyMap.begin(); it != d->m_keyMap.end(); ++it )
if( it.value() == cut ) return false;
}
d->m_keyMap.insert( item, cut );
return true;
}
示例2: parsing
void parsing()
{
KShortcut cut;
cut = KShortcut(";, Alt+;; ;, Alt+A, ;");
QVERIFY(cut.primary() == QKeySequence::fromString(";, Alt+;"));
QVERIFY(cut.alternate() == QKeySequence::fromString(";, Alt+A, ;"));
cut = KShortcut("Win+E");
//QTest::ignoreMessage(QtWarningMsg, "QKeySequence::fromString: Unknown modifier 'win+'");
QEXPECT_FAIL("", "Qt Bug 205255 - QKeySequence silently discards unknown key modifiers", Continue);
QVERIFY(cut.isEmpty());
cut = KShortcut("Meta+E");
QVERIFY(cut.primary()[0] == (Qt::META | Qt::Key_E));
//qDebug() << QKeySequence(Qt::ALT | Qt::Key_Plus).toString();
//qDebug() << QKeySequence(Qt::ALT | Qt::Key_Minus).toString();
cut = KShortcut("Alt+Plus"); // KDE3 said "Alt+Plus", while Qt4 says "Alt++", so KShortcut has to handle this
QVERIFY(cut.primary()[0] == (Qt::ALT | Qt::Key_Plus));
cut = KShortcut("Alt+Minus"); // KDE3 said "Alt+Minus", while Qt4 says "Alt+-", so KShortcut has to handle this
QVERIFY(cut.primary()[0] == (Qt::ALT | Qt::Key_Minus));
}