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


C++ Transition::endItem方法代码示例

本文整理汇总了C++中Transition::endItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Transition::endItem方法的具体用法?C++ Transition::endItem怎么用?C++ Transition::endItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transition的用法示例。


在下文中一共展示了Transition::endItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AcceptTrans

void TransWidget::AcceptTrans()
{
    if(edited==NULL)
    {
        emit reportError(QString("Please, select a transition to edit, edit it and then press OK."));
        OKButton->setDisabled(true);
        sourceNameCombo->clear();
        destNameCombo->clear();
        return;
    }
    if(!mod->checkTransitonExists(edited))
    {
        emit reportError(QString("The Transition You have been editing has been deleted"));
        edited=NULL;
        OKButton->setDisabled(true);
        sourceNameCombo->clear();
        destNameCombo->clear();
        return;
    }
    if (edited->startItem()->getName()==sourceNameCombo->currentText() && edited->endItem()->getName()==destNameCombo->currentText())
    {
        if(mod->checkTransCondAvailabe(edited, conditionLineEdit->text()))
        {
            edited->setCondition(conditionLineEdit->text());
            edited->setSubtask(mod->getState(stateCombo->currentText()));
            OKButton->setDisabled(false);
            edited->setToolTip(QString().fromStdString(edited->Print()));
        }
        else //that condition is already used for the source state
        {
            emit reportError(QString("The condition you specified is already in use for the source state."));
        }
    }
    else if( ( edited->startItem()->getName() == sourceNameCombo->currentText() && mod->checkTransCondAvailabe(edited, conditionLineEdit->text()) )
            ||mod->checkTransCondAvailabe(mod->getState(sourceNameCombo->currentText()), conditionLineEdit->text()))
    {
        QString subtaskName = mod->getSubNameOfTrans(edited);
        QGraphicsScene * scene = edited->getScene();
        /*if(edited->startItem()->getName()!=sourceNameCombo->currentText())
        {
            mod->changeSourceStateofTrans(edited, sourceNameCombo->currentText());
        }else{}
        if(edited->endItem()->getName()!=destNameCombo->currentText())
        {
            mod->changeDestStateofTrans(edited, destNameCombo->currentText());
        }else{}
        edited->setCondition(conditionLineEdit->text());
        edited->setSubtask(mod->getState(stateCombo->currentText()));
        OKButton->setDisabled(false);
        edited->setToolTip(QString().fromStdString(edited->Print()));*/
Transition * todelete = edited;
        mod->deleteTransition(edited);
        scene->removeItem(todelete);
        delete todelete;//?

        Transition * tr = new Transition(mod->getState(sourceNameCombo->currentText(), subtaskName), mod->getState(destNameCombo->currentText(), subtaskName));
        tr->setScene(scene);
        tr->setCondition(conditionLineEdit->text());
        tr->setSubtask(mod->getState(stateCombo->currentText()));
        tr->startItem()->addTransition(tr);
        if(tr->startItem()!=tr->endItem())tr->endItem()->addTransition(tr);
        tr->setZValue(-1000.0);
        tr->updatePosition();

        tr->setToolTip(QString().fromStdString(tr->Print()));
        scene->addItem(tr);
        bool test = mod->tryInsertTransition(tr);

        this->TransSelected(tr);
    }
    else
    {
        emit reportError(QString("The condition you specified is already in use for the source state."));
    }
}
开发者ID:twiniars,项目名称:RESpecTa,代码行数:75,代码来源:transWidget.cpp


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