本文整理汇总了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"));
}
示例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: 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();
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}