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


C++ QUndoCommand::setText方法代码示例

本文整理汇总了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;
    }
}
开发者ID:KDE,项目名称:ktutorial,代码行数:14,代码来源:EditActions.cpp

示例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);
}
开发者ID:gudajan,项目名称:Windsim,代码行数:15,代码来源:objectContainer.cpp

示例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;
    }
}
开发者ID:KDE,项目名称:ktutorial,代码行数:16,代码来源:EditActions.cpp

示例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);
}
开发者ID:stt,项目名称:tiled,代码行数:21,代码来源:mapdocument.cpp

示例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());
    }
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:24,代码来源:qundostack.cpp

示例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;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:24,代码来源:sipQtWidgetsQUndoCommand.cpp


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