本文整理汇总了C++中QVariant::listEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariant::listEnd方法的具体用法?C++ QVariant::listEnd怎么用?C++ QVariant::listEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariant
的用法示例。
在下文中一共展示了QVariant::listEnd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatProperties
void formatProperties( const QMap<int,KTNEFProperty*>& props, QListView *lv, QListViewItem *item, const QString& prefix )
{
for ( QMap<int,KTNEFProperty*>::ConstIterator it=props.begin(); it!=props.end(); ++it )
{
QListViewItem *newItem = 0;
if ( lv )
newItem = new QListViewItem( lv, ( *it )->keyString() );
else if ( item )
newItem = new QListViewItem( item, ( *it )->keyString() );
else
{
kdWarning() << "formatProperties() called with no listview and no item" << endl;
return;
}
QVariant value = ( *it )->value();
if ( value.type() == QVariant::List )
{
newItem->setOpen( true );
newItem->setText( 0, newItem->text( 0 ) + " [" + QString::number( value.asList().count() ) + "]" );
int i = 0;
for ( QValueList<QVariant>::ConstIterator lit=value.listBegin(); lit!=value.listEnd(); ++lit, i++ )
new QListViewItem( newItem, "[" + QString::number( i ) + "]", KTNEFProperty::formatValue( *lit ) );
}
else if ( value.type() == QVariant::DateTime )
newItem->setText( 1, value.asDateTime().toString() );
else
{
newItem->setText( 1, ( *it )->valueString() );
newItem->setText( 2, prefix + "_" + QString::number( it.key() ) );
}
}
}
示例2: findNamedProp
QString KTNEFPropertySet::findNamedProp(const QString& name, const QString& fallback, bool upper)
{
for ( QMap<int,KTNEFProperty*>::Iterator it = properties_.begin();
it != properties_.end();
++it ){
if ( (*it)->name().isValid() ){
QString s;
if ( (*it)->name().type() == QVariant::String )
s = (*it)->name().asString();
else
s = QString().sprintf( "0X%04X", (*it)->name().asUInt() );
if( s.upper() == name.upper() ){
QVariant value = ( *it )->value();
if( value.type() == QVariant::List ){
s = "";
for ( QValueList<QVariant>::ConstIterator lit = value.listBegin();
lit != value.listEnd();
++lit ){
if( !s.isEmpty() )
s += ',';
s += KTNEFProperty::formatValue( *lit, false );
}
}else{
s = KTNEFProperty::formatValue( value, false );
}
return upper ? s.upper() : s;
}
}
}
return fallback;
}
示例3: createOption
DrMain* Foomatic2Loader::modifyDriver( DrMain *driver ) const
{
if ( !m_foodata.isEmpty() )
{
QValueList<DrBase*> optList;
DrGroup *grp = NULL;
QVariant V = m_foodata.find( "VAR" ).data();
if ( !V.isNull() && V.type() == QVariant::Map )
{
QVariant v = V.mapFind( "args" ).data();
if ( !v.isNull() && v.type() == QVariant::List )
{
QValueList<QVariant>::ConstIterator it = v.listBegin();
for ( ; it!=v.listEnd(); ++it )
{
if ( ( *it ).type() != QVariant::Map )
continue;
DrBase *opt = createOption( ( *it ).toMap() );
if ( opt )
optList.append( opt );
else
kdWarning( 500 ) << "Failed to create option: " << ( *it ).toMap()[ "name" ].toString() << endl;
}
}
else
{
v = V.mapFind( "args_byname" ).data();
if ( !v.isNull() && v.type() == QVariant::Map )
{
QMap<QString,QVariant>::ConstIterator it = v.mapBegin();
for ( ; it!=v.mapEnd(); ++it )
{
if ( ( *it ).type() != QVariant::Map )
continue;
DrBase *opt = createOption( ( *it ).toMap() );
if ( opt )
optList.append( opt );
else
kdWarning( 500 ) << "Failed to create option: " << ( *it ).toMap()[ "name" ].toString() << endl;
}
}
}
}
for ( QValueList<DrBase*>::ConstIterator it=optList.begin(); it!=optList.end(); ++it )
{
DrBase *opt = ( *it );
if ( opt )
{
switch ( opt->type() )
{
case DrBase::List:
case DrBase::Boolean:
delete opt;
break;
default:
{
if ( !grp )
{
grp = new DrGroup;
grp->set( "text", i18n( "Adjustments" ) );
driver->addGroup( grp );
}
DrBase *oldOpt = driver->findOption( opt->name() );
if ( oldOpt && oldOpt->type() == DrBase::List )
{
QPtrListIterator<DrBase> it( *( static_cast<DrListOption*>( oldOpt )->choices() ) );
QString fixedvals;
for ( ; it.current(); ++it )
{
fixedvals.append( it.current()->name() );
if ( !it.atLast() )
fixedvals.append( "|" );
}
opt->set( "fixedvals", fixedvals );
}
driver->removeOptionGlobally( opt->name() );
grp->addOption( opt );
break;
}
}
}
}
}
return driver;
}
示例4: re
DrMain* Foomatic2Loader::buildDriver() const
{
if ( m_foodata.isEmpty() )
return NULL;
QVariant v = m_foodata.find( "VAR" ).data();
if ( !v.isNull() && v.type() == QVariant::Map )
{
DrMain *driver = new DrMain;
QMap<QString,DrGroup*> groups;
driver->set( "manufacturer", v.mapFind( "make" ).data().toString() );
driver->set( "model", v.mapFind( "model" ).data().toString() );
driver->set( "matic_printer", v.mapFind( "id" ).data().toString() );
driver->set( "matic_driver", v.mapFind( "driver" ).data().toString() );
driver->set( "text", QString( "%1 %2 (%3)" ).arg( driver->get( "manufacturer" ) ).arg( driver->get( "model" ) ).arg( driver->get( "matic_driver" ) ) );
if ( m_foodata.contains( "POSTPIPE" ) )
driver->set( "postpipe", m_foodata.find( "POSTPIPE" ).data().toString() );
v = v.mapFind( "args" ).data();
if ( !v.isNull() && v.type() == QVariant::List )
{
QValueList<QVariant>::ConstIterator it = v.listBegin();
for ( ; it!=v.listEnd(); ++it )
{
if ( ( *it ).type() != QVariant::Map )
continue;
DrBase *opt = createOption( ( *it ).toMap() );
if ( opt )
{
QString group = DrGroup::groupForOption( opt->name() );
DrGroup *grp = NULL;
if ( !groups.contains( group ) )
{
grp = new DrGroup;
grp->set( "text", group );
driver->addGroup( grp );
groups.insert( group, grp );
}
else
grp = groups[ group ];
grp->addOption( opt );
if ( opt->name() == "PageSize" )
{
// try to add the corresponding page sizes
QVariant choices = ( *it ).mapFind( "vals_byname" ).data();
QRegExp re( "(\\d+) +(\\d+)" );
if ( choices.type() == QVariant::Map )
{
QMap<QString,QVariant>::ConstIterator it = choices.mapBegin();
for ( ; it!=choices.mapEnd(); ++it )
{
QString driverval = ( *it ).mapFind( "driverval" ).data().toString();
if ( re.exactMatch( driverval ) )
{
driver->addPageSize( new DrPageSize( it.key(), re.cap( 1 ).toInt(), re.cap( 2 ).toInt(), 36, 24, 36, 24 ) );
}
}
}
}
}
else
kdWarning( 500 ) << "Failed to create option: " << ( *it ).toMap()[ "name" ].toString() << endl;
}
}
return driver;
}
return NULL;
}