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


C++ ProjectItem::child方法代码示例

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


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

示例1: SetCurrent

void Workspace::SetCurrent(std::string projectName, std::string documentName)
{
    Project*     proj     = nullptr;
    ProjectItem* projItem = nullptr;
    Document*    doc      = nullptr;
    ProjectItem* docItem  = nullptr;

    // Get project;
    proj = m_Projects[projectName].get();

    // Get project view item.
    auto projRowItem = m_ProjectsModel.findItems(Utils::StringW2Q(projectName));
    projItem = (ProjectItem*) projRowItem.first();

    // If document is not specified, use first doc.
    auto docs = proj->GetDocuments();
    if (documentName.empty() && !docs.empty())
    {
        documentName = docs.front()->GetName();
    }

    // If there is document, get document and document view item.
    if (!documentName.empty())
    {
        // Get document.
        for (auto d : docs)
        {
            if (d->GetName().compare(documentName) == 0)
            {
                doc = d;
                break;
            }
        }

        // Get document view item.
        for (int i = 0; i < (int) docs.size(); i++)
        {
            ProjectItem* di = (ProjectItem*) projItem->child(i);
            if(di->GetName().compare(documentName) == 0)
            {
                docItem = di;
                break;
            }
        }
    }

    SetCurrent(proj, projItem, doc, docItem);
}
开发者ID:imilos,项目名称:Application-of-pattern-recognition-algorithms-in-neutron-dosimetry,代码行数:48,代码来源:workspace.cpp

示例2: generateReportContent

QString Report::generateReportContent(TreeModel * model)
{
    QString header = "<html><head><style type=\"text/css\">  TABLE.MYTABLE  {     font-family:arial;     font-size:10pt;     width:500px;     border-style:double;     border-color:black;     border-width:1px;  }  TH.MYTABLE  {     font-size:10pt;     background-color:#FFFFFF;     color:black;     border-width:1px;  }  TR.MYTABLE  {  }  TD.MYTABLE  {     font-size:10pt;     background-color:#FFFFFF;     color:black;     border-style:solid;     border-width:1px;     text-align:center;  }  TD.MYTABLEGREEN  {     font-size:10pt;     background-color:#00EB4E;     color:black;     border-style:solid;     border-width:1px;     text-align:center;  }  TD.MYTABLERED  {     font-size:10pt;     background-color:#FF0033;     color:black;     border-style:solid;     border-width:1px;     text-align:center;  }</style></head><body><center> <TABLE border=\"0\"><tr><td><TABLE CLASS=\"MYTABLE\">    <THEAD>      <TR CLASS=\"MYTABLE\">        <TH CLASS=\"MYTABLE\">Project name</TH>        <TH CLASS=\"MYTABLE\">Suite name</TH>        <TH CLASS=\"MYTABLE\">Test Case name</TH>        <TH CLASS=\"MYTABLE\">Status</TH>      </TR>    </THEAD>    <TBODY>";
    QString table_footer = "</TBODY></TABLE>";
    QString footer = "</center></body>";
    QString td_start = "<TD CLASS=\"MYTABLE\">";
    QString td_start_green = "<TD CLASS=\"MYTABLEGREEN\">";
    QString td_start_red   = "<TD CLASS=\"MYTABLERED\">";
    QString td_end = "</TD>";
    QString tr_start = "<TR CLASS=\"MYTABLE\">";
    QString tr_end = "</TR>";
    QString src;
    int total_pass = 0;
    int total_fail = 0;
    int total_norun = 0;
    ProjectItem * proj;
    SuiteItem * suite;
    TestCaseItem * test;

    src += header;
    for(int i = 0; i < model->rowCount(); i++)
	{
		QModelIndex child = model->index(i,0);
		proj = static_cast<ProjectItem *>(child.internalPointer());
        for(int j = 0; j < proj->childCount(); j++)
        {
            suite = static_cast<SuiteItem *>(proj->child(j));
            for(int k = 0; k < suite->childCount(); k++)
            {
                test = static_cast<TestCaseItem *>(suite->child(k));
                src += tr_start;
                src += td_start + QString("%1").arg(proj->getItemName()) + td_end;
                src += td_start + QString("%1").arg(suite->getItemName()) + td_end;
                src += td_start + QString("%1").arg(test->getItemName()) + td_end;

                if(test->getStatus() == TestCaseStatus::Passed)
                {
                    src += td_start_green + QString("PASS<br>") + td_end;
                    total_pass++;
                }
                else if(test->getStatus() == TestCaseStatus::Failed)
                {
                    src += td_start_red + QString("FAIL<br>") + td_end;
                    total_fail++;
                }
                else
                {
                    src += td_start + QString("No run<br>") + td_end;
                    total_norun++;
                }
                src += tr_end;
            }
        }
	}
    src += table_footer;
    src += "</td></tr><tr><td><br>";
    src += "PASS: " + QString("%1").arg(total_pass) + "<br>FAIL: " + QString("%1").arg(total_fail) + "<br>No run: " + QString("%1").arg(total_norun) + "<br>";
    src += "<br>Report generated on " + QDate::currentDate().toString("d MMMM yyyy") + " at " + QTime::currentTime().toString();
    src += "</td></tr></table>";
    src += footer;

    return src;
}
开发者ID:sdpper,项目名称:MQTester,代码行数:63,代码来源:report.cpp


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