本文整理汇总了C++中QVariantMap::save方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantMap::save方法的具体用法?C++ QVariantMap::save怎么用?C++ QVariantMap::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantMap
的用法示例。
在下文中一共展示了QVariantMap::save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newInstance
ProviderPtr
ImporterManager::createProvider( QVariantMap config )
{
Controller *controller = Amarok::Components::statSyncingController();
// First, get rid of the old provider instance. Note: the StatSyncing::Config
// remembers the provider by the id, even when it's unregistered. After this
// block, old instance should be destroyed, its destructor called.
if( config.contains( "uid" ) )
{
const QString providerId = config.value( "uid" ).toString();
if( m_providers.contains( providerId ) )
{
ProviderPtr oldProvider = m_providers.take( providerId );
if( controller )
controller->unregisterProvider( oldProvider );
}
}
// Create a concrete provider using the config. The QueuedConnection in connect()
// is important, because on reconfigure we *destroy* the old provider instance
ImporterProviderPtr provider = newInstance( config );
if( !provider )
{
warning() << __PRETTY_FUNCTION__ << "created provider is null!";
return provider;
}
connect( provider.data(), SIGNAL(reconfigurationRequested(QVariantMap)),
SLOT(createProvider(QVariantMap)), Qt::QueuedConnection);
m_providers.insert( provider->id(), provider );
// Register the provider
if( controller )
{
controller->registerProvider( provider );
// Set provider to offline
if( Config *config = controller->config() )
{
config->updateProvider( provider->id(), provider->prettyName(),
provider->icon(), /*online*/ false );
config->save();
}
}
// Save the settings
KConfigGroup group = providerConfig( provider );
group.deleteGroup();
foreach( const QString &key, provider->m_config.keys() )
group.writeEntry( key, provider->m_config.value( key ) );
group.sync();
return provider;
}