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


C++ QUndoStack::setActive方法代码示例

本文整理汇总了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();
	}
}
开发者ID:rcari,项目名称:libPantin,代码行数:29,代码来源:AddNewGeometry.cpp

示例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);
}
开发者ID:rcari,项目名称:libPantin,代码行数:47,代码来源:ProjectAddModel.cpp

示例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();
}
开发者ID:rcari,项目名称:libPantin,代码行数:37,代码来源:3dsFileImporterWizard.cpp


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