本文整理汇总了C++中Attr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Attr::getName方法的具体用法?C++ Attr::getName怎么用?C++ Attr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attr
的用法示例。
在下文中一共展示了Attr::getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterButton_clicked
void FilterWidget::filterButton_clicked()
{
TQueryMap opts;
Attr *a = 0;
for( int i = 0; i < attrList.size(); i++ )
{
QApplication::processEvents();
a = attrList.at(i);
if ( widgetMap.contains( a->getName() ) )
{
QWidget *w = widgetMap[a->getName() ];
if ( false == w->isEnabled() )
continue;
QString v = getWidgetData( a, w );
if ( !v.isEmpty() ) {
int flag = Like | Case;
bool ok;
v.toInt(&ok, 10);
if ( ok ) {
flag = Equal;
}
if (a->getType() == Attr::Bool) {
flag = Equal;
}
if ( opts.size() > 0 ) {
flag |= And;
}
opts.insert(a->getName(),keeper->prepareParam(flag, v));
}
}
}
emit filterActivated(opts);
}
示例2: dumpTree
void dumpTree(std::ostream& result, Node node, std::string indent)
{
while (node) {
result << indent << node << '\n';
Element element = interface_cast<Element>(node);
if (element.getNodeType() == Node::ELEMENT_NODE) {
ObjectArray<Attr> attrArray = element.getAttributes();
assert(attrArray);
for (unsigned int i = 0; i < attrArray.getLength(); ++i) {
Attr attr = attrArray.getElement(i);
assert(attr);
result << indent << " " << attr.getName() << "=\"" << attr.getValue() << "\"\n";
}
}
if (node.hasChildNodes())
dumpTree(result, node.getFirstChild(), indent + ((node.getNodeType() == Node::DOCUMENT_NODE) ? "| " : " "));
node = node.getNextSibling();
}
}
示例3: runTest
/*
* Runs the test case.
*/
void runTest()
{
Document doc;
NodeList addressList;
Node testNode;
NamedNodeMap attributes;
Attr streetAttr;
String strong1;
String strong2;
doc = (Document) baseT::load("hc_staff", false);
addressList = doc.getElementsByTagName(SA::construct_from_utf8("acronym"));
testNode = addressList.item(1);
attributes = testNode.getAttributes();
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("class"));
strong1 = streetAttr.getNodeName();
strong2 = streetAttr.getName();
baseT::assertEquals("class", strong1, __LINE__, __FILE__);
baseT::assertEquals("class", strong2, __LINE__, __FILE__);
}
示例4: actionAdd_clicked
void ListWidget::actionAdd_clicked()
{
QModelIndex index = view->selectionModel()->currentIndex();
int row = model->rowCount();
try
{
if (!model->insertRow(row, index.parent() ))
return;
} catch (SqlError &err) {
QMessageBox::critical( this, tr("Error"), err.getText() + "\n" + err.getQuery() );
}
updateActions();
try
{
Attr *a;
QList<Attr*> attr = obj->attrSchema();
QStringList views = obj->getViewItem();
for( int i = 0; i < attr.size(); i++ )
{
a = attr.at(i);
QString name = a->getName();
if ( !views.contains(name) )
continue;
QModelIndex child = model->index(row, i, index.parent());
model->setData(child, QVariant(), Qt::EditRole);
}
}
catch ( SqlError &err )
{
QMessageBox::critical(this, tr("Sql error"), err.getText().append( err.getQuery() ) );
}
}
示例5: QWidget
FilterWidget::FilterWidget(TQueryMap opts, QList<Attr*> list, Keeper *keeper, QWidget *parent) :
QWidget(parent), keeper(keeper), attrList(list), parentWidget(parent), opts(opts)
{
innerWidget = new QWidget(this);
scrollArea = new QScrollArea(this);
scrollArea->setWidget( innerWidget );
scrollArea->setWidgetResizable( true );
innerLayout = new QGridLayout( innerWidget );
innerLayout->setSpacing(2);
innerLayout->setMargin(2);
QWidget *w = 0;
int row = 0;
for( int i = 0; i < attrList.size(); i++ )
{
QApplication::processEvents();
Attr *a = list.at(i);
w = getAttrWidget( a, innerWidget );
if ( !w ) continue;
QCheckBox *box = new QCheckBox( a->getTitle(), innerWidget);
if ( opts.contains(a->getName()) ) {
box->setChecked(true);
setWidgetData(a, w, opts[a->getName()]);
} else {
w->setEnabled(false);
}
widgetMap.insert( a->getName(), w );
connect(box, SIGNAL(toggled(bool)), w, SLOT(setEnabled(bool)));
innerLayout->addWidget( box, row++, 0 );
innerLayout->addWidget( w, row++, 0);
}
filterButton = new QPushButton(tr("Filter"), innerWidget);
filterButton->setIcon(QIcon(":/icons/magnifier.png"));
clearButton = new QPushButton(tr("Clear"), innerWidget);
clearButton->setIcon(QIcon(":/icons/cancel.png"));
connect(filterButton, SIGNAL(clicked()), this, SLOT(filterButton_clicked()));
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearButton_clicked()));
QBoxLayout *hlayout = new QBoxLayout(QBoxLayout::LeftToRight);
hlayout->addWidget(filterButton);
hlayout->addWidget(clearButton);
hlayout->addItem(new QSpacerItem(10, 10 ));
innerLayout->addLayout(hlayout, row++, 0);
innerLayout->addItem( new QSpacerItem(20, 1200, QSizePolicy::Maximum, QSizePolicy::Maximum), row, 0);
QGridLayout *glayout = new QGridLayout(this);
glayout->addWidget(scrollArea, 0, 0);
glayout->setSpacing(2);
glayout->setMargin(2);
setLayout(glayout);
}