本文整理汇总了C++中IDList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ IDList::append方法的具体用法?C++ IDList::append怎么用?C++ IDList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDList
的用法示例。
在下文中一共展示了IDList::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadConversionTable
void UnitsDialog::loadConversionTable( ConversionTable *table, Unit::Type type )
{
UnitList unitList;
database->loadUnits( &unitList, type );
QStringList unitNames;
IDList unitIDs; // We need to store these in the table, so rows and cols are identified by unitID, not name.
table->clear();
for ( UnitList::const_iterator unit_it = unitList.constBegin(); unit_it != unitList.constEnd(); ++unit_it ) {
unitNames.append( ( *unit_it ).name() );
unitIDs.append( ( *unit_it ).id() ); // append the element
}
// Resize the table
table->resize( unitNames.count(), unitNames.count() );
// Set the table labels, and id's
table->setRowLabels( unitNames );
table->setColumnLabels( unitNames );
table->setUnitIDs( unitIDs );
// Load and Populate the data into the table
UnitRatioList ratioList;
database->loadUnitRatios( &ratioList, type );
for ( UnitRatioList::const_iterator ratio_it = ratioList.constBegin(); ratio_it != ratioList.constEnd(); ++ratio_it ) {
table->setRatio( ( *ratio_it ).unitId1(), ( *ratio_it ).unitId2(), ( *ratio_it ).ratio() );
}
}
示例2: allIDs
static IDList allIDs(QSqlDatabase db, const QString& tableName)
{
IDList ret;
QSqlQuery query(QString("SELECT id FROM %1").arg(tableName), db);
while(query.next()) {
ret.append(query.record().value("id").toULongLong());
}
return ret;
}