本文整理汇总了C++中TVar::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TVar::getName方法的具体用法?C++ TVar::getName怎么用?C++ TVar::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVar
的用法示例。
在下文中一共展示了TVar::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shortVarName
QStringList VarUnit::shortVarName(TVar * var){
QStringList names;
if (!var || var->getName() == "_G"){
names << "";
return names;
}
names << var->getName();
TVar * p = var->getParent();
while (p && p->getName() != "_G"){
names.insert(0, p->getName());
p = p->getParent();
}
return names;
}
示例2: buildVarTree
void VarUnit::buildVarTree(QTreeWidgetItem* p, TVar* var, bool showHidden)
{
QList<QTreeWidgetItem*> cList;
QListIterator<TVar*> it(var->getChildren(true));
while (it.hasNext()) {
TVar* child = it.next();
if (showHidden || !isHidden(child)) {
QStringList s1;
s1 << child->getName();
auto pItem = new QTreeWidgetItem(s1);
pItem->setText(0, child->getName());
pItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsTristate | Qt::ItemIsUserCheckable);
pItem->setToolTip(0, "Checked variables will be saved and loaded with your profile.");
pItem->setCheckState(0, Qt::Unchecked);
if (isSaved(child)) {
pItem->setCheckState(0, Qt::Checked);
}
if (!shouldSave(child)) { // 6 is lua_tfunction, parent must be saveable as well if not global
pItem->setFlags(pItem->flags() & ~(Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable));
pItem->setForeground(0, QBrush(QColor("grey")));
pItem->setToolTip(0, "");
}
pItem->setData(0, Qt::UserRole, child->getValueType());
QIcon icon;
switch (child->getValueType()) {
case 5:
icon.addPixmap(QPixmap(QStringLiteral(":/icons/table.png")), QIcon::Normal, QIcon::Off);
break;
case 6:
icon.addPixmap(QPixmap(QStringLiteral(":/icons/function.png")), QIcon::Normal, QIcon::Off);
break;
default:
icon.addPixmap(QPixmap(QStringLiteral(":/icons/variable.png")), QIcon::Normal, QIcon::Off);
break;
}
pItem->setIcon(0, icon);
wVars.insert(pItem, child);
cList.append(pItem);
if (child->getValueType() == 5) {
buildVarTree((QTreeWidgetItem*)pItem, child, showHidden);
}
}
}
p->addChildren(cList);
}
示例3: varName
QStringList VarUnit::varName(TVar * var){
QStringList names;
names << "_G";
if (var == base || ! var ){
return names;
}
names << var->getName();
TVar * p = var->getParent();
while (p && p != base){
names.insert(1, p->getName());
if (p == base)
break;
p = p->getParent();
}
return names;
}