本文整理汇总了C++中QUndoCommand::undo方法的典型用法代码示例。如果您正苦于以下问题:C++ QUndoCommand::undo方法的具体用法?C++ QUndoCommand::undo怎么用?C++ QUndoCommand::undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUndoCommand
的用法示例。
在下文中一共展示了QUndoCommand::undo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCondition
//------------------------------------------------------------------------------
void AssignmentRuleTest::updateCondition()
{
AssignmentRule* rule(ruleWithMultipleConditions);
QUndoCommand* cmd = rule->updateCondition(1,
AssignmentRule::Condition(AssignmentRule::Date, AssignmentRule::Before, false, "5/5/13"));
// Assert pre-conditions
QCOMPARE(rule->conditionCount(), 2);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
QCOMPARE(rule->conditionAt(1).field, AssignmentRule::DepositAccount);
QCOMPARE(rule->conditionAt(1).op, AssignmentRule::BeginsWith);
QCOMPARE(rule->conditionAt(1).value, QString("Condition2"));
cmd->redo();
QCOMPARE(rule->conditionCount(), 2);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
QCOMPARE(rule->conditionAt(1).field, AssignmentRule::Date);
QCOMPARE(rule->conditionAt(1).op, AssignmentRule::Before);
QCOMPARE(rule->conditionAt(1).value, QString("5/5/13"));
cmd->undo();
QCOMPARE(rule->conditionCount(), 2);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
QCOMPARE(rule->conditionAt(1).field, AssignmentRule::DepositAccount);
QCOMPARE(rule->conditionAt(1).op, AssignmentRule::BeginsWith);
QCOMPARE(rule->conditionAt(1).value, QString("Condition2"));
}
示例2: addCondition
//------------------------------------------------------------------------------
void AssignmentRuleTest::addCondition()
{
QFETCH(uint, ruleId);
QFETCH(int, oldCount);
QFETCH(int, newCount);
QFETCH(int, newIndex);
QFETCH(int, existingIndex);
AssignmentRule* rule = rules->find(ruleId);
QUndoCommand* cmd = rule->addCondition();
QCOMPARE(rule->conditionCount(), oldCount);
AssignmentRule::Field field;
if (existingIndex >= 0)
{
field = rule->conditionAt(existingIndex).field;
}
cmd->redo();
QCOMPARE(rule->conditionCount(), newCount);
QCOMPARE(rule->conditionAt(newIndex).field, AssignmentRule::FieldNotDefined);
if (existingIndex >= 0)
{
QCOMPARE(rule->conditionAt(existingIndex).field, field);
}
cmd->undo();
QCOMPARE(rule->conditionCount(), oldCount);
if (existingIndex >= 0)
{
QCOMPARE(rule->conditionAt(existingIndex).field, field);
}
}
示例3: removeConditionFromRuleWithNone
//------------------------------------------------------------------------------
void AssignmentRuleTest::removeConditionFromRuleWithNone()
{
AssignmentRule* rule(ruleWithNoConditions);
QUndoCommand* cmd = rule->removeCondition(0);
QCOMPARE(rule->conditionCount(), 0);
cmd->redo();
QCOMPARE(rule->conditionCount(), 0);
cmd->undo();
QCOMPARE(rule->conditionCount(), 0);
}
示例4: removeConditionFromRuleWithOne
//------------------------------------------------------------------------------
void AssignmentRuleTest::removeConditionFromRuleWithOne()
{
AssignmentRule* rule(ruleWithOneCondition);
QUndoCommand* cmd = rule->removeCondition(0);
QCOMPARE(rule->conditionCount(), 1);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
cmd->redo();
QCOMPARE(rule->conditionCount(), 0);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::FieldNotDefined);
cmd->undo();
QCOMPARE(rule->conditionCount(), 1);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
}
示例5: removeConditionFromRuleWithMany
//------------------------------------------------------------------------------
void AssignmentRuleTest::removeConditionFromRuleWithMany()
{
AssignmentRule* rule(ruleWithMultipleConditions);
QUndoCommand* cmd = rule->removeCondition(0);
QCOMPARE(rule->conditionCount(), 2);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
QCOMPARE(rule->conditionAt(1).field, AssignmentRule::DepositAccount);
cmd->redo();
QCOMPARE(rule->conditionCount(), 1);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::DepositAccount);
cmd->undo();
QCOMPARE(rule->conditionCount(), 2);
QCOMPARE(rule->conditionAt(0).field, AssignmentRule::Payee);
QCOMPARE(rule->conditionAt(1).field, AssignmentRule::DepositAccount);
}
示例6: undo
void CUndoRedoStack::undo()
{
QUndoCommand* topCmd = d->undoStack.count() ? d->undoStack.pop() : 0;
if(!topCmd)
return;
QString cmdText = topCmd->text();
topCmd->undo();
d->redoStack.push(topCmd);
qWarning("Undo: %s", qPrintable(cmdText));
// emit change notifications.
emit undone(cmdText);
emit canUndoChanged(d->undoStack.count());
emit canRedoChanged(d->redoStack.count());
}
示例7: sipIsDerived
static PyObject *meth_QUndoCommand_undo(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf));
{
QUndoCommand *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QUndoCommand, &sipCpp))
{
(sipSelfWasArg ? sipCpp->QUndoCommand::undo() : sipCpp->undo());
Py_INCREF(Py_None);
return Py_None;
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QUndoCommand, sipName_undo, doc_QUndoCommand_undo);
return NULL;
}