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


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

本文整理汇总了C++中QUndoCommand::redo方法的典型用法代码示例。如果您正苦于以下问题:C++ QUndoCommand::redo方法的具体用法?C++ QUndoCommand::redo怎么用?C++ QUndoCommand::redo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QUndoCommand的用法示例。


在下文中一共展示了QUndoCommand::redo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: KoPathPointIndex

void KarbonPathRefineCommand::redo()
{
    // check if we have to create the insert points commands
    if (! d->initialized) {
        // create insert point commands, one for each point to insert
        // into each segment
        for (uint iteration = 0; iteration < d->insertCount; ++iteration) {
            // in each iteration collect the (iteration+1)th point which starts a segments
            // into which we insert the point of this iteration
            QList<KoPathPointData> pointData;
            // calculate the segment position where to insert the point
            qreal insertPosition = 1.0 / (d->insertCount + 1 - iteration);
            int subpathCount = d->path->subpathCount();
            // iterate over the paths subpaths
            for (int subpathIndex = 0; subpathIndex < subpathCount; ++subpathIndex) {
                int pointCount = d->path->subpathPointCount(subpathIndex);
                // iterate over the subpaths points
                for (int pointIndex = 0; pointIndex < pointCount; ++pointIndex) {
                    // we only collect the (iteration+1)th point
                    if ((pointIndex + 1) % (iteration + 1) != 0)
                        continue;
                    pointData.append(KoPathPointData(d->path, KoPathPointIndex(subpathIndex, pointIndex)));
                }
            }
            // create the command and execute it
            QUndoCommand * cmd = new KoPathPointInsertCommand(pointData, insertPosition, this);
            cmd->redo();
        }
        d->initialized = true;
    } else {
        QUndoCommand::redo();
    }
    d->path->update();
}
开发者ID:KDE,项目名称:calligra-history,代码行数:34,代码来源:KarbonPathRefineCommand.cpp

示例4: 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

示例5: 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

示例6: testMoveDownOverlapping

void TestShapeReorderCommand::testMoveDownOverlapping()
{
#if 0 // disable a current alogrithm does not yet support this
    MockShape shape1, shape2, shape3, shape4, shape5;
    
    shape1.setSize(QSizeF(100, 100));
    shape1.setZIndex(1);
    shape2.setSize(QSizeF(100, 100));
    shape2.setZIndex(2);

    shape3.setSize(QSizeF(300, 300));
    shape3.setZIndex(3);
    
    shape4.setSize(QSizeF(100, 100));
    shape4.setPosition(QPointF(200,200));
    shape4.setZIndex(4);
    shape5.setSize(QSizeF(100, 100));
    shape5.setPosition(QPointF(200,200));
    shape5.setZIndex(5);
    
    QList<KShape*> shapes;
    shapes.append(&shape1);
    shapes.append(&shape2);
    shapes.append(&shape3);
    shapes.append(&shape4);
    shapes.append(&shape5);
    
    MockCanvas canvas;
    KShapeManager manager(&canvas, shapes);
    
    QVERIFY(shape1.zIndex() < shape2.zIndex());
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QVERIFY(shape3.zIndex() < shape4.zIndex());
    QVERIFY(shape4.zIndex() < shape5.zIndex());
    
    QList<KShape*> selectedShapes;
    selectedShapes.append(&shape5);
    
    QUndoCommand * cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::LowerShape);
    cmd->redo();
    delete cmd;
    
    QVERIFY(shape1.zIndex() < shape2.zIndex());
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QVERIFY(shape3.zIndex() < shape4.zIndex());
    QVERIFY(shape4.zIndex() > shape5.zIndex());
    QVERIFY(shape3.zIndex() > shape5.zIndex());
#endif
}
开发者ID:KDE,项目名称:koffice,代码行数:49,代码来源:TestShapeReorderCommand.cpp

示例7: 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

示例8: redo

void CUndoRedoStack::redo()
{
    QUndoCommand* topCmd = d->redoStack.count() ? d->redoStack.pop() : 0;
    if(!topCmd)
        return;

    QString cmdText = topCmd->text();
    topCmd->redo();
    d->undoStack.push(topCmd);
    qWarning("Redo: %s", qPrintable(cmdText));

    // emit change notifications.
    emit redone(cmdText);
    emit canUndoChanged(d->undoStack.count());
    emit canRedoChanged(d->redoStack.count());
}
开发者ID:banduladh,项目名称:levelfour,代码行数:16,代码来源:CUndoRedo.cpp

示例9: testMoveUpOverlapping

void TestShapeReorderCommand::testMoveUpOverlapping()
{
    MockShape shape1, shape2, shape3, shape4, shape5;
    
    shape1.setSize(QSizeF(100, 100));
    shape1.setZIndex(1);
    shape2.setSize(QSizeF(100, 100));
    shape2.setZIndex(2);

    shape3.setSize(QSizeF(300, 300));
    shape3.setZIndex(3);
    
    shape4.setSize(QSizeF(100, 100));
    shape4.setPosition(QPointF(200,200));
    shape4.setZIndex(4);
    shape5.setSize(QSizeF(100, 100));
    shape5.setPosition(QPointF(200,200));
    shape5.setZIndex(5);
    
    QList<KShape*> shapes;
    shapes.append(&shape1);
    shapes.append(&shape2);
    shapes.append(&shape3);
    shapes.append(&shape4);
    shapes.append(&shape5);
    
    MockCanvas canvas;
    KShapeManager manager(&canvas, shapes);
    
    QVERIFY(shape1.zIndex() < shape2.zIndex());
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QVERIFY(shape3.zIndex() < shape4.zIndex());
    QVERIFY(shape4.zIndex() < shape5.zIndex());
    
    QList<KShape*> selectedShapes;
    selectedShapes.append(&shape1);
    
    QUndoCommand * cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::RaiseShape);
    cmd->redo();
    delete cmd;
    
    QVERIFY(shape1.zIndex() > shape2.zIndex());
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QVERIFY(shape1.zIndex() < shape3.zIndex());
    QVERIFY(shape3.zIndex() < shape4.zIndex());
    QVERIFY(shape4.zIndex() < shape5.zIndex());
}
开发者ID:KDE,项目名称:koffice,代码行数:47,代码来源:TestShapeReorderCommand.cpp

示例10: sipIsDerived

static PyObject *meth_QUndoCommand_redo(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::redo() : sipCpp->redo());

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QUndoCommand, sipName_redo, doc_QUndoCommand_redo);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:22,代码来源:sipQtWidgetsQUndoCommand.cpp

示例11: testSendToBack

void TestShapeReorderCommand::testSendToBack()
{
    MockShape shape1, shape2, shape3;

    shape1.setSize(QSizeF(100, 100));
    shape1.setZIndex(1);
    shape2.setSize(QSizeF(100, 100));
    shape2.setZIndex(2);
    shape3.setSize(QSizeF(100, 100));
    shape3.setZIndex(3);
    QList<KShape*> shapes;
    shapes.append(&shape1);
    shapes.append(&shape2);
    shapes.append(&shape3);

    MockCanvas canvas;
    KShapeManager manager(&canvas, shapes);

    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&shape1), 0);
    QCOMPARE(shapes.indexOf(&shape2), 1);
    QCOMPARE(shapes.indexOf(&shape3), 2);

    QList<KShape*> selectedShapes;
    selectedShapes.append(&shape3);

    QUndoCommand * cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::SendToBack);
    cmd->redo();

    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&shape3), 0);
    QCOMPARE(shapes.indexOf(&shape1), 1);
    QCOMPARE(shapes.indexOf(&shape2), 2);

    delete cmd;
}
开发者ID:KDE,项目名称:koffice,代码行数:36,代码来源:TestShapeReorderCommand.cpp

示例12: testSendToBackChildren

void TestShapeReorderCommand::testSendToBackChildren()
{
    MockShape shape1, shape2, shape3;
    
    shape1.setSize(QSizeF(100, 100));
    shape1.setZIndex(1);
    shape2.setSize(QSizeF(100, 100));
    shape2.setZIndex(2);
    shape3.setSize(QSizeF(100, 100));
    shape3.setZIndex(3);
    
    MockContainer container;
    container.addShape(&shape1);
    container.addShape(&shape2);
    container.addShape(&shape3);
    
    QList<KShape*> shapes;
    shapes.append(&shape1);
    shapes.append(&shape2);
    shapes.append(&shape3);
    shapes.append(&container);
    
    MockCanvas canvas;
    KShapeManager manager(&canvas, shapes);
    
    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&container), 0); // atm the parent is always lower than its children
    QCOMPARE(shapes.indexOf(&shape1), 1);
    QCOMPARE(shapes.indexOf(&shape2), 2);
    QCOMPARE(shapes.indexOf(&shape3), 3);
    
    QList<KShape*> selectedShapes;
    selectedShapes.append(&shape3);
    
    QUndoCommand * cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::SendToBack);
    cmd->redo();
    delete cmd;
    
    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&container), 0); // atm the parent is always lower than its children
    QCOMPARE(shapes.indexOf(&shape3), 1);
    QVERIFY(shape3.zIndex() < shape1.zIndex());
    QCOMPARE(shapes.indexOf(&shape1), 2);
    QVERIFY(shape1.zIndex() < shape2.zIndex());
    QCOMPARE(shapes.indexOf(&shape2), 3);
    
    selectedShapes.clear();
    selectedShapes.append(&shape2);
    
    cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::SendToBack);
    cmd->redo();
    delete cmd;
    
    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&container), 0); // atm the parent is always lower than its children
    QCOMPARE(shapes.indexOf(&shape2), 1);
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QCOMPARE(shapes.indexOf(&shape3), 2);
    QVERIFY(shape3.zIndex() < shape1.zIndex());
    QCOMPARE(shapes.indexOf(&shape1), 3);
    
    selectedShapes.clear();
    selectedShapes.append(&shape1);
    
    cmd = KShapeReorderCommand::createCommand(selectedShapes, &manager, KShapeReorderCommand::SendToBack);
    cmd->redo();
    delete cmd;
    
    qSort(shapes.begin(), shapes.end(), KShape::compareShapeZIndex);
    QCOMPARE(shapes.indexOf(&container), 0); // atm the parent is always lower than its children
    QCOMPARE(shapes.indexOf(&shape1), 1);
    QVERIFY(shape1.zIndex() < shape2.zIndex());
    QCOMPARE(shapes.indexOf(&shape2), 2);
    QVERIFY(shape2.zIndex() < shape3.zIndex());
    QCOMPARE(shapes.indexOf(&shape3), 3);
}
开发者ID:KDE,项目名称:koffice,代码行数:76,代码来源:TestShapeReorderCommand.cpp


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