本文整理汇总了C++中Spell::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::remove方法的具体用法?C++ Spell::remove怎么用?C++ Spell::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell::remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
void SpellItem::keyPressEvent(QKeyEvent * event)
{
Spell * spellParent = NULL;
switch (event->key())
{
// Delete : remove that spell
case Qt::Key::Key_Delete :
spellParent = spell_->getParent();
if (spellParent == NULL)
{
// Can't remove the top level spell, so just clear it
cout << "Clearing top level spell" << endl;
spell_->clear();
}
else
{
cout << "Removing spell" << endl;
spellParent->remove(spell_);
}
emit(changedSpell());
break;
case Qt::Key::Key_Plus:
// No need for the alternative add
//if (event->modifiers() & Qt::ShiftModifier)
spell_->addEmptyChild();
emit(changedSpell());
break;
case Qt::Key::Key_Escape:
clearFocus();
break;
}
}
示例2: keyPressEvent
void RuneItem::keyPressEvent(QKeyEvent * event)
{
Spell * spellParent = NULL;
switch (event->key())
{
// Delete : remove that spell
case Qt::Key::Key_Delete:
spellParent = spell_->getParent();
if (spellParent == NULL)
{
// Can't remove the top level spell, so just clear it
cout << "Clearing top level spell" << endl;
spell_->clear();
emit(changedSpell());
}
else
{
cout << "Removing spell" << endl;
spellParent->remove(spell_);
emit(changedSpell());
}
break;
case Qt::Key::Key_Minus:
// remove : remove last
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier))
spell_->removeLastChild();
else if (QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier))
spell_->removeLastModifier();
else
spell_->removeLastComponent();
emit(changedSpell());
break;
case Qt::Key::Key_Plus:
case Qt::Key::Key_Insert:
if (QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier))
spell_->addEmptyModifier(); // adding a modifier
else
spell_->addEmptyComponent(); // adding a component
emit(changedSpell());
break;
case Qt::Key::Key_Back:
spell_->setRune(-1);
image_.setPixmap(QPixmap());
emit(changedSpell());
break;
case Qt::Key::Key_Enter:
case Qt::Key::Key_Return:
chooseRune();
break;
case Qt::Key::Key_Escape:
clearFocus();
break;
}
}