本文整理汇总了C++中QUndoStack::setActive方法的典型用法代码示例。如果您正苦于以下问题:C++ QUndoStack::setActive方法的具体用法?C++ QUndoStack::setActive怎么用?C++ QUndoStack::setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUndoStack
的用法示例。
在下文中一共展示了QUndoStack::setActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: performAction
void AddShape::performAction(Block* block) const
{
Node* node = static_cast<Node*>(block);
GenerateShape dialog(_generator, PantinEngine::MainWindow());
if(dialog.createShape())
{
K_ASSERT( node->instance()->fastInherits<Model>() ); // The instance HAS to be a model in Nigel. Only models can contain geometry.
Model* model = static_cast<Model*>(node->instance());
QUndoStack* undoStack = PantinEngine::InstanceUndoStack( model );
undoStack->setActive(true);
undoStack->beginMacro(
tr("Adding new %1 to node %2")
.arg(_generator->shape()->blockName(), node->blockName())
);
AddBlock* addGeometry = new AddBlock(model->geometries(), dialog.geometry());
undoStack->push(addGeometry);
AddBlock* addReference = new AddBlock(node, dialog.geometryInstance());
undoStack->push(addReference);
undoStack->endMacro();
}
}
示例2: performAction
void ProjectAddModel::performAction(Block* block) const
{
K_ASSERT( block->fastInherits<Project>() ) // It has to be a Project !
Project* project = static_cast<Project*>(block);
bool nameOk;
QString name = QInputDialog::getText(
GooeyEngine::MainWindow(),
tr("Add Model"),
tr("Please enter a name for the new Model"),
QLineEdit::Normal,
tr("New Model"),
&nameOk
);
if(!nameOk)
{
// User canceled !
return;
}
if(name.isEmpty())
{
QMessageBox::warning(
GooeyEngine::MainWindow(),
tr("Add Model"),
tr("Invalid Model name !")
);
return;
}
// Create a new model in the project !
Model* model = project->createModel(name);
// Retrieve the undo stack for the project.
QUndoStack* stack = PantinEngine::InstanceUndoStack(project);
K_ASSERT( stack )
stack->setActive(true);
Pantin::commands::ProjectAddModel* add = new Pantin::commands::ProjectAddModel(project, model);
stack->push(add);
}
示例3: ended
void LoadObjectsProgressPage::ended(kint status)
{
_ended = status;
// Add all data to the project
Project* project = static_cast<Project*>(PantinEngine::ActiveManager()->rootInstance());
QFileInfo info(((FileImporterWizard*)wizard())->file()->fileName());
// Create a model within the project
Nigel::project::Model* model = project->createModel(info.baseName());
model->blockName(info.baseName());
QList<Geometry*> geometries = _tasklet->geometries();
for(kint i=0; i<geometries.size(); i++)
{
model->geometries()->addBlock(geometries.at(i));
}
QList<Node*> sceneNodes = _tasklet->sceneNodes();
Node* rootNode = model->scene()->visualSceneInstance()->instantiatedElement()->node(0);
for(kint i=0; i<sceneNodes.size(); i++)
{
rootNode->addBlock(sceneNodes.at(i));
}
// Save the model to disk
model->manager()->saveInstance(model);
// Add a reference to the project
ProjectAddModel* add = new ProjectAddModel(project, model);
QUndoStack* stack = PantinEngine::InstanceUndoStack(project);
stack->setActive(true);
stack->push(add);
emit completeChanged();
}