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


C++ Domain::displayName方法代码示例

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


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

示例1:

DomainDialog::DomainDialog(Domain subject, QWidget *parent) :
	QDialog(parent),
	_result(QDialog::Rejected),
	ui(new Ui::DomainDialog),
	_domain(subject)
{
	initDialog();
	setWindowTitle("Edit Domain");

	//Setup the blacklist for the name line edit
	ui->nameEdit->setText(subject.name());
	QStringList blacklist=ConfigurationStack::instance().current().domainNameList();
	blacklist.removeAll(subject.name());
	ui->nameEdit->setBlacklist(blacklist);

	//Setup the data of the widgets
	ui->displayNameEdit->setText(subject.displayName());
	ui->iconButton->setIcon(QIcon(subject.iconPath()));
	ui->iconButton->setToolTip(subject.iconPath());
	ui->descriptionPlainTextEdit->setPlainText(subject.description());
	ui->confidentialitySlider->setValue(subject.confidentiality());
	ui->reliabilitySlider->setValue(subject.reliability());

	//Setup the default domain checkbox depending on whether the domain is default
	if(ConfigurationStack::instance().current().defaultDomain()==subject)
	{
		ui->defaultDomain->setChecked(true);
		ui->defaultDomain->setEnabled(false);
	}
	else
		ui->defaultDomain->setChecked(false);
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: addRule

void SortedRulesTreeWidget::addRule(const AbstractRule *rule, const Domain dom)
{
    QTreeWidgetItem *topItem=NULL, *secondItem=NULL;

    //Look for the top-level item (either the rule's application or domain)
    for(int i=0, count=ui->rulesList->topLevelItemCount(); i<count && !topItem; ++i)
    {
        QTreeWidgetItem *tmp=ui->rulesList->topLevelItem(i);

        if(((_sort_mode==SortByApp) && (rule->program().name()==tmp->data(0, Qt::UserRole).toString())) ||
                ((_sort_mode==SortByDomain) && (dom.name()==tmp->data(0, Qt::UserRole).toString())))
            topItem=tmp;
    }

    //If there was no top-level item, create one
    if(!topItem)
    {
        if(_sort_mode==SortByApp)
        {
            topItem=new QTreeWidgetItem(ui->rulesList, QStringList(rule->program().displayName()));
            topItem->setData(0, ItemTypeRole, ProgramItem);
            topItem->setData(0, Qt::UserRole, rule->program().name());
            topItem->setFirstColumnSpanned(true);

            QPixmap icon(rule->program().icon());
            if(icon.isNull())
                icon.load(":/icons/default-program");

            topItem->setIcon(0, QIcon(icon));
        }
        else
        {
            topItem=new QTreeWidgetItem(ui->rulesList, QStringList(dom.displayName()));
            topItem->setData(0, ItemTypeRole, DomainItem);
            topItem->setData(0, Qt::UserRole, dom.name());
            topItem->setFirstColumnSpanned(true);

            QPixmap icon(dom.iconPath());
            if(icon.isNull())
                icon.load(":/icons/default-domain");

            topItem->setIcon(0, QIcon(icon));
        }

    }

    //Check if it has the child item we want (respectively domain or application)
    for(int i=0, count=topItem->childCount(); i<count && !secondItem; ++i)
    {
        QTreeWidgetItem *tmp=topItem->child(i);

        if(((_sort_mode==SortByDomain) && (rule->program().name()==tmp->data(0, Qt::UserRole).toString())) ||
                ((_sort_mode==SortByApp) && (dom.name()==tmp->data(0, Qt::UserRole).toString())))
            secondItem=tmp;
    }

    //Create one if it didn't exist
    if(!secondItem)
    {
        if(_sort_mode==SortByApp)
        {
            secondItem=new QTreeWidgetItem(topItem, QStringList(dom.displayName()));
            secondItem->setData(0, ItemTypeRole, DomainItem);
            secondItem->setData(0, Qt::UserRole, dom.name());
            secondItem->setFirstColumnSpanned(true);

            QPixmap icon(dom.iconPath());
            if(icon.isNull())
                icon.load(":/icons/default-domain");

            secondItem->setIcon(0, QIcon(icon));
        }
        else
        {
            secondItem=new QTreeWidgetItem(topItem, QStringList(rule->program().displayName()));
            secondItem->setData(0, ItemTypeRole, ProgramItem);
            secondItem->setData(0, Qt::UserRole, rule->program().name());
            secondItem->setFirstColumnSpanned(true);

            QPixmap icon(rule->program().icon());
            if(icon.isNull())
                icon.load(":/icons/default-program");

            secondItem->setIcon(0, QIcon(icon));
        }
    }

    //Add our rule to the second-level item
    QStringList itemStrList(rule->displayName());
    itemStrList.append(rule->ruleType());
    QTreeWidgetItem *ruleItem= new QTreeWidgetItem(secondItem, itemStrList);
    ruleItem->setData(0, ItemTypeRole, RuleItem);
    ruleItem->setData(0, Qt::UserRole, rule->id());
    ruleItem->setData(1, Qt::UserRole, rule->ruleType());

    //If the rule has warnings, display a warning icon
    if(ConfigurationStack::instance().ruleHasWarnings(rule->id()))
        ruleItem->setIcon(0, QIcon(":/icons/warning"));

    //Finally, display the matching rules of the rule
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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