本文整理汇总了C++中QLibrary::setFileNameAndVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ QLibrary::setFileNameAndVersion方法的具体用法?C++ QLibrary::setFileNameAndVersion怎么用?C++ QLibrary::setFileNameAndVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLibrary
的用法示例。
在下文中一共展示了QLibrary::setFileNameAndVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool load()
{
m_libUdev.setLoadHints(QLibrary::ResolveAllSymbolsHint);
m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 1);
m_loaded = m_libUdev.load();
if (resolveMethods())
return true;
m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 0);
m_loaded = m_libUdev.load();
return resolveMethods();
}
示例2: initialize
void Converter::initialize()
{
initialized = true;
QLibrary libopencc;
libopencc.setFileNameAndVersion("opencc", "1.0.0");
if (!libopencc.load())
return;
opencc_open = (opencc_t (*)(const char *))libopencc.resolve("opencc_open");
if (opencc_open == NULL)
return;
opencc_close = (int (*)(opencc_t))libopencc.resolve("opencc_close");
if (opencc_close == NULL)
return;
opencc_convert_utf8 = (char * (*)(opencc_t, const char *, size_t))libopencc.resolve("opencc_convert_utf8");
if (opencc_convert_utf8 == NULL)
return;
opencc_errno = (opencc_error (*)(void))libopencc.resolve("opencc_errno");
if (opencc_errno == NULL)
return;
opencc_perror = (void (*)(const char *))libopencc.resolve("opencc_perror");
if (opencc_perror == NULL)
return;
s_loaded = true;
}
示例3: init
//----------------------------------------------------------------------------
void ctkPluginFrameworkContext::init()
{
log() << "initializing";
if (firstInit && ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT
== props[ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN])
{
deleteFWDir();
firstInit = false;
}
// Pre-load libraries
// This may speed up installing new plug-ins if they have dependencies on
// one of these libraries. It prevents repeated loading and unloading of the
// pre-loaded libraries during caching of the plug-in meta-data.
if (props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].isValid())
{
QStringList preloadLibs = props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].toStringList();
QLibrary::LoadHints loadHints;
QVariant loadHintsVariant = props[ctkPluginConstants::FRAMEWORK_PLUGIN_LOAD_HINTS];
if (loadHintsVariant.isValid())
{
loadHints = loadHintsVariant.value<QLibrary::LoadHints>();
}
foreach(QString preloadLib, preloadLibs)
{
QLibrary lib;
QStringList nameAndVersion = preloadLib.split(":");
QString libraryName;
if (nameAndVersion.count() == 1)
{
libraryName = nameAndVersion.front();
lib.setFileName(nameAndVersion.front());
}
else if (nameAndVersion.count() == 2)
{
libraryName = nameAndVersion.front() + "." + nameAndVersion.back();
lib.setFileNameAndVersion(nameAndVersion.front(), nameAndVersion.back());
}
else
{
qWarning() << "Wrong syntax in" << preloadLib << ". Use <lib-name>[:version]. Skipping.";
continue;
}
lib.setLoadHints(loadHints);
log() << "Pre-loading library" << lib.fileName() << "with hints [" << static_cast<int>(loadHints) << "]";
if (!lib.load())
{
qWarning() << "Pre-loading library" << lib.fileName() << "failed:" << lib.errorString() << "\nCheck your library search paths.";
}
}