本文整理汇总了C++中QUndoGroup::stacks方法的典型用法代码示例。如果您正苦于以下问题:C++ QUndoGroup::stacks方法的具体用法?C++ QUndoGroup::stacks怎么用?C++ QUndoGroup::stacks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUndoGroup
的用法示例。
在下文中一共展示了QUndoGroup::stacks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteStack
void tst_QUndoGroup::deleteStack()
{
QUndoGroup group;
QUndoStack *stack1 = new QUndoStack(&group);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1);
QCOMPARE(group.activeStack(), (QUndoStack*)0);
stack1->setActive();
QCOMPARE(group.activeStack(), stack1);
QUndoStack *stack2 = new QUndoStack(&group);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack2);
QCOMPARE(group.activeStack(), stack1);
QUndoStack *stack3 = new QUndoStack(&group);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack2 << stack3);
QCOMPARE(group.activeStack(), stack1);
delete stack2;
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1 << stack3);
QCOMPARE(group.activeStack(), stack1);
delete stack1;
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack3);
QCOMPARE(group.activeStack(), (QUndoStack*)0);
stack3->setActive(false);
QCOMPARE(group.activeStack(), (QUndoStack*)0);
stack3->setActive(true);
QCOMPARE(group.activeStack(), stack3);
group.removeStack(stack3);
QCOMPARE(group.stacks(), QList<QUndoStack*>());
QCOMPARE(group.activeStack(), (QUndoStack*)0);
delete stack3;
}
示例2: addRemoveStack
void tst_QUndoGroup::addRemoveStack()
{
QUndoGroup group;
QUndoStack stack1(&group);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1);
QUndoStack stack2;
group.addStack(&stack2);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);
group.addStack(&stack1);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);
group.removeStack(&stack1);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);
group.removeStack(&stack1);
QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);
group.removeStack(&stack2);
QCOMPARE(group.stacks(), QList<QUndoStack*>());
}