本文整理汇总了C++中QScopedPointer::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QScopedPointer::contains方法的具体用法?C++ QScopedPointer::contains怎么用?C++ QScopedPointer::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScopedPointer
的用法示例。
在下文中一共展示了QScopedPointer::contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readLockTranslations
quint32 MUtils::Translation::get_country(const QString &langId)
{
QReadLocker readLockTranslations(&g_translation_lock);
const QString key = langId.simplified().toLower();
if(key.isEmpty() || g_translation_data.isNull() || (!g_translation_data->contains(key)))
{
return 0;
}
return (*g_translation_data)[key].second.second;
}
示例2: lamexp_tools_check
/*
* Check for tool
*/
bool lamexp_tools_check(const QString &toolName)
{
QReadLocker readLock(&g_lamexp_tools_lock);
if(!g_lamexp_tools_data.isNull())
{
const QString key = toolName.simplified().toLower();
return g_lamexp_tools_data->contains(key);
}
return false;
}
示例3: ringUnderPoint
QgsGeometry* QgsMapToolDeleteRing::ringUnderPoint( QgsPoint p, QgsFeatureId& fid, int& partNum, int& ringNum )
{
//There is no clean way to find if we are inside the ring of a feature,
//so we iterate over all the features visible in the canvas
//If several rings are found at this position, the smallest one is chosen,
//in order to be able to delete a ring inside another ring
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterRect( toLayerCoordinates( vlayer, mCanvas->extent() ) ) );
QgsFeature f;
const QgsGeometry* g;
QScopedPointer<QgsGeometry> ringGeom;
QgsMultiPolygon pol;
QgsPolygon tempPol;
QScopedPointer<QgsGeometry> tempGeom;
double area = std::numeric_limits<double>::max();
while ( fit.nextFeature( f ) )
{
g = f.constGeometry();
if ( !g )
continue;
if ( g->wkbType() == QGis::WKBPolygon || g->wkbType() == QGis::WKBPolygon25D )
{
pol = QgsMultiPolygon() << g->asPolygon();
}
else
{
pol = g->asMultiPolygon();
}
for ( int i = 0; i < pol.size() ; ++i )
{//for each part
if ( pol[i].size() > 1 )
{
for ( int j = 1; j < pol[i].size();++j )
{
tempPol = QgsPolygon() << pol[i][j];
tempGeom.reset( QgsGeometry::fromPolygon( tempPol ) );
if ( tempGeom->area() < area && tempGeom->contains( &p ) )
{
fid = f.id();
partNum = i;
ringNum = j;
area = tempGeom->area();
ringGeom.reset( tempGeom.take() );
}
}
}
}
}
return ringGeom.take();
}
示例4: readLock
/*
* Lookup tool path
*/
const QString &lamexp_tools_lookup(const QString &toolName)
{
QReadLocker readLock(&g_lamexp_tools_lock);
if(!g_lamexp_tools_data.isNull())
{
const QString key = toolName.simplified().toLower();
if(g_lamexp_tools_data->contains(key))
{
return (*g_lamexp_tools_data)[key].first->filePath();
}
}
return g_null_string;
}
示例5: writeLockTranslations
bool MUtils::Translation::insert(const QString &langId, const QString &qmFile, const QString &langName, const quint32 &systemId, const quint32 &country)
{
QWriteLocker writeLockTranslations(&g_translation_lock);
const QString key = langId.simplified().toLower();
if(key.isEmpty() || qmFile.isEmpty() || langName.isEmpty() || (systemId < 1))
{
return false;
}
if(g_translation_data.isNull())
{
g_translation_data.reset(new translation_store_t());
}
if(g_translation_data->contains(key))
{
qWarning("Translation store already contains entry for '%s', going to replace!", MUTILS_UTF8(key));
}
g_translation_data->insert(key, MAKE_ENTRY(langName, qmFile, systemId, country));
return true;
}
示例6: lamexp_tools_register
/*
* Register tool
*/
void lamexp_tools_register(const QString &toolName, LockedFile *const file, const quint32 &version, const QString &tag)
{
QWriteLocker writeLock(&g_lamexp_tools_lock);
if(!file)
{
MUTILS_THROW("lamexp_register_tool: Tool file must not be NULL!");
}
if(g_lamexp_tools_data.isNull())
{
g_lamexp_tools_data.reset(new tool_hash_t());
atexit(lamexp_tools_clean_up);
}
const QString key = toolName.simplified().toLower();
if(g_lamexp_tools_data->contains(key))
{
MUTILS_THROW("lamexp_register_tool: Tool is already registered!");
}
g_lamexp_tools_data->insert(key, MAKE_ENTRY(file, version, tag));
}