本文整理汇总了C++中QUndoCommand::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QUndoCommand::setText方法的具体用法?C++ QUndoCommand::setText怎么用?C++ QUndoCommand::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUndoCommand
的用法示例。
在下文中一共展示了QUndoCommand::setText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addStep
void EditActions::addStep() {
Step* step = new Step();
QUndoCommand* parentCommand = new QUndoCommand();
parentCommand->setText(i18nc("@action", "Add step"));
TutorialCommands(mTutorialEditor->tutorial()).addStep(step, parentCommand);
StepDataWidget* widget = new StepDataWidget(step);
widget->enableStepIdCompletion(mTutorialEditor->tutorial());
widget->setParentUndoCommand(parentCommand);
if (showEditionDialog(widget) == QDialog::Rejected) {
delete parentCommand;
}
}
示例2: rendererModification
void ObjectContainer::rendererModification(std::vector<QJsonObject> data)
{
QUndoCommand * transformation = new QUndoCommand();
transformation->setText("Modify via 3D view");
for (const auto& json : data)
{
ObjectItem* item = getItem(json["id"].toInt());
if (!item)
continue;
new ModifyObjectCmd(item->data().toJsonObject(), json, item, Position | Scaling | Rotation, transformation); // Add command to command group
}
g_undoStack.push(transformation);
}
示例3: addReaction
void EditActions::addReaction() {
Q_ASSERT(mCurrentStep);
Reaction* reaction = new Reaction();
QUndoCommand* parentCommand = new QUndoCommand();
parentCommand->setText(i18nc("@action", "Add reaction"));
StepCommands(mCurrentStep).addReaction(reaction, parentCommand);
ReactionWidget* widget = new ReactionWidget(reaction);
widget->enableStepIdCompletion(mTutorialEditor->tutorial(), mCurrentStep);
widget->setParentUndoCommand(parentCommand);
if (showEditionDialog(widget) == QDialog::Rejected) {
delete parentCommand;
}
}
示例4: duplicateLayer
/**
* Duplicates the currently selected layer.
*/
void MapDocument::duplicateLayer()
{
if (!mCurrentLayer)
return;
Layer *duplicate = mCurrentLayer->clone();
duplicate->setName(tr("Copy of %1").arg(duplicate->name()));
if (duplicate->layerType() == Layer::ObjectGroupType)
static_cast<ObjectGroup*>(duplicate)->resetObjectIds();
auto parentLayer = mCurrentLayer ? mCurrentLayer->parentLayer() : nullptr;
const int index = layerIndex(mCurrentLayer) + 1;
QUndoCommand *cmd = new AddLayer(this, index, duplicate, parentLayer);
cmd->setText(tr("Duplicate Layer"));
mUndoStack->push(cmd);
setCurrentLayer(duplicate);
}
示例5: beginMacro
void QUndoStack::beginMacro(const QString &text)
{
Q_D(QUndoStack);
QUndoCommand *cmd = new QUndoCommand();
cmd->setText(text);
if (d->macro_stack.isEmpty()) {
while (d->index < d->command_list.size())
delete d->command_list.takeLast();
if (d->clean_index > d->index)
d->clean_index = -1; // we've deleted the clean state
d->command_list.append(cmd);
} else {
d->macro_stack.last()->d->child_list.append(cmd);
}
d->macro_stack.append(cmd);
if (d->macro_stack.count() == 1) {
emit canUndoChanged(false);
emit undoTextChanged(QString());
emit canRedoChanged(false);
emit redoTextChanged(QString());
}
}
示例6: sipReleaseType
static PyObject *meth_QUndoCommand_setText(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const QString* a0;
int a0State = 0;
QUndoCommand *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QUndoCommand, &sipCpp, sipType_QString,&a0, &a0State))
{
sipCpp->setText(*a0);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
Py_INCREF(Py_None);
return Py_None;
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QUndoCommand, sipName_setText, doc_QUndoCommand_setText);
return NULL;
}