当前位置: 首页>>代码示例>>C++>>正文


C++ QUndoCommand::undo方法代码示例

本文整理汇总了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"));
}
开发者ID:vimofthevine,项目名称:UnderBudget,代码行数:28,代码来源:AssignmentRuleTest.cpp

示例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);
	}
}
开发者ID:vimofthevine,项目名称:UnderBudget,代码行数:34,代码来源:AssignmentRuleTest.cpp

示例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);
}
开发者ID:vimofthevine,项目名称:UnderBudget,代码行数:12,代码来源:AssignmentRuleTest.cpp

示例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);
}
开发者ID:vimofthevine,项目名称:UnderBudget,代码行数:15,代码来源:AssignmentRuleTest.cpp

示例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);
}
开发者ID:vimofthevine,项目名称:UnderBudget,代码行数:17,代码来源:AssignmentRuleTest.cpp

示例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());
}
开发者ID:banduladh,项目名称:levelfour,代码行数:16,代码来源:CUndoRedo.cpp

示例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;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:22,代码来源:sipQtWidgetsQUndoCommand.cpp


注:本文中的QUndoCommand::undo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。