当前位置: 首页>>代码示例>>C++>>正文


C++ QLibrary类代码示例

本文整理汇总了C++中QLibrary的典型用法代码示例。如果您正苦于以下问题:C++ QLibrary类的具体用法?C++ QLibrary怎么用?C++ QLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QLibrary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QFileInfo

QLibrary* RazorPluginInfo::loadLibrary(const QString& libDir) const
{
    QString baseName, path;
    QFileInfo fi = QFileInfo(fileName());
    path = fi.canonicalPath();
    baseName = value("X-Razor-Library", fi.completeBaseName()).toString();

    QString soPath = QString("%1/lib%2.so").arg(libDir, baseName);
    QLibrary* library = new QLibrary(soPath);

    if (!library->load())
    {
        qWarning() << QString("Can't load plugin lib \"%1\"").arg(soPath) << library->errorString();
        delete library;
        return 0;
    }

    QString locale = QLocale::system().name();
    QTranslator* translator = new QTranslator(library);

    translator->load(QString("%1/%2/%2_%3.qm").arg(path, baseName, locale));
    qApp->installTranslator(translator);

    return library;
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:25,代码来源:razorplugininfo.cpp

示例2: load

bool load(const char* dllname)
{
    if (library(dllname)) {
        DBG("'%s' is already loaded\n", dllname);
        return true;
    }
    std::list<std::string> libnames = sLibNamesMap[dllname];
    if (libnames.empty())
        libnames.push_back(dllname);
    std::list<std::string>::const_iterator it;
    QLibrary *dll = new QLibrary();
    for (it = libnames.begin(); it != libnames.end(); ++it) {
        dll->setFileName((*it).c_str());
        if (dll->load())
            break;
        DBG("%s\n", dll->errorString().toLocal8Bit().constData()); //why qDebug use toUtf8() and printf use toLocal8Bit()?
    }
    if (it == libnames.end()) {
        DBG("No dll loaded\n");
        delete dll;
        return false;
    }
    DBG("'%s' is loaded~~~\n", dll->fileName().toUtf8().constData());
    sDllMap[dllname] = dll; //map.insert will not replace the old one
    return true;
}
开发者ID:kuiba,项目名称:dllapi,代码行数:26,代码来源:dllapi.cpp

示例3: setSafeMode

/**
 * \brief Load a OPluginItem for the specified interface
 * This will open the resource of the OPluginItem::path() and then will query
 * if the Interface specified in the uuid is available and then will manage the
 * resource and Interface.
 *
 * @param item The OPluginItem that should be loaded
 * @param uuid The Interface to query for
 *
 * @return Either 0 in case of failure or the Plugin as QUnknownInterface*
 */
QUnknownInterface* OGenericPluginLoader::load( const OPluginItem& item, const QUuid& uuid) {
    /*
     * Check if there could be a library
     */
    QString pa = item.path();
    if ( pa.isEmpty() )
        return 0l;

    /*
     * See if we get a library
     * return if we've none
     */
    setSafeMode( pa, true );
    QLibrary *lib = Internal::OPluginLibraryHolder::self()->ref( pa );
    if ( !lib ) {
        setSafeMode();
        return 0l;
    }

    /**
     * try to load the plugin and just in case initialize the pointer to a pointer again
     */
    QUnknownInterface*  iface=0;
    if ( lib->queryInterface(  uuid,  &iface ) == QS_OK ) {
        installTranslators( item.name() );
        m_library.insert( iface, lib );
    }else
        iface = 0;

    setSafeMode();

    return iface;
}
开发者ID:opieproject,项目名称:opie,代码行数:44,代码来源:opluginloader.cpp

示例4: error

bool
FirebirdDriver::initialize()
{
    if (_library != NULL)
	return true;

    FirebirdConfig config;
    if (!config.load())
	return error("Can't read firebird.cfg file");

    // Set firebird install directory
#ifdef WIN32
    SetEnvironmentVariable("INTERBASE", parseDir(config.installDir));
    SetEnvironmentVariable("FIREBIRD", parseDir(config.installDir));
#else
    setenv("INTERBASE", parseDir(config.installDir), true);
    setenv("FIREBIRD", parseDir(config.installDir), true);
#endif

    // Try to load the library
    QLibrary* library = new QLibrary(config.library);
    if (!library->load()) {
	libraryError();
	delete library;
	return error("Can't load firebird library: " + config.library);
    }

    _library = library;
    _procs = new FirebirdProcs(_library);

    return true;
}
开发者ID:cwarden,项目名称:quasar,代码行数:32,代码来源:firebird_driver.cpp

示例5: defined

Garmin::IDevice * CDeviceGarmin::getDevice()
{
    Garmin::IDevice * (*func)(const char*) = 0;
    Garmin::IDevice * dev = 0;

#if defined(Q_OS_MAC)
    // MacOS X: plug-ins are stored in the bundle folder
    QString libname     = QString("%1/lib%2" XSTR(SHARED_LIB_EXT))
        .arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "Resources/Drivers"))
        .arg(devkey);
#else
    QString libname     = QString("%1/lib%2" XSTR(SHARED_LIB_EXT)).arg(XSTR(PLUGINDIR)).arg(devkey);
#endif
    QString funcname    = QString("init%1").arg(devkey);

    QLibrary lib;
    lib.setFileName(libname);
    bool lib_loaded = lib.load();
    if (lib_loaded)
    {
        func = (Garmin::IDevice * (*)(const char*))lib.resolve(funcname.toLatin1());
    }

    if(!lib_loaded || func == 0)
    {
        QMessageBox warn;
        warn.setIcon(QMessageBox::Warning);
        warn.setWindowTitle(tr("Error ..."));
        warn.setText(tr("Failed to load driver."));
        warn.setDetailedText(lib.errorString());
        warn.setStandardButtons(QMessageBox::Ok);
        warn.exec();
        return 0;
    }

    dev = func(INTERFACE_VERSION);
    if(dev == 0)
    {
        QMessageBox warn;
        warn.setIcon(QMessageBox::Warning);
        warn.setWindowTitle(tr("Error ..."));
        warn.setText(tr("Driver version mismatch."));
        QString detail = QString(
            tr("The version of your driver plugin \"%1\" does not match the version QLandkarteGT expects (\"%2\").")
            ).arg(libname).arg(INTERFACE_VERSION);
        warn.setDetailedText(detail);
        warn.setStandardButtons(QMessageBox::Ok);
        warn.exec();
        func = 0;
    }

    if(dev)
    {
        dev->setPort(port.toLatin1());
        dev->setGuiCallback(GUICallback,this);
    }

    return dev;
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:59,代码来源:CDeviceGarmin.cpp

示例6: supportsTransaction

bool QgsTransaction::supportsTransaction( const QgsVectorLayer* layer )
{
  QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( layer->providerType() );
  if ( !lib )
    return false;

  return lib->resolve( "createTransaction" );
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:8,代码来源:qgstransaction.cpp

示例7: resolveFunction

static T resolveFunction(QLibrary &lib, const char *name)
{
  T temp = reinterpret_cast<T>(lib.resolve(name));
  if (temp == nullptr) {
    throw std::runtime_error(QObject::tr("invalid 7-zip32.dll: %1").arg(lib.errorString()).toLatin1().constData());
  }
  return temp;
}
开发者ID:RevReese,项目名称:modorganizer,代码行数:8,代码来源:installationmanager.cpp

示例8: c

QHSWidgetImpl::~QHSWidgetImpl()
{
    delete iHsWidgetPublisher;

    const QObjectList& c(children());
    foreach (QObject* child, c)
    {
        QLibrary* lib = qobject_cast<QLibrary*> (child);
        if (lib) lib->unload();
    }
开发者ID:Motaz-Alnuweiri,项目名称:BatteryStatus,代码行数:10,代码来源:qhswidget_impl.cpp

示例9: 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();
    }
开发者ID:3163504123,项目名称:phantomjs,代码行数:12,代码来源:GamepadsQt.cpp

示例10: eCompass_GetVersion

//eComnpass libray funcitons
void eCompass_GetVersion(int *pMajorVer, int *pMinorVer)
{
    if(eCompass.isLoaded())
    {
        pFuncGetVersion eCompass_GetVersion = (pFuncGetVersion) eCompass.resolve("eCompass_GetVersion");
        if(eCompass_GetVersion)
        {
            eCompass_GetVersion(pMajorVer, pMinorVer);
        }
    }
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:ExternalLibrary.cpp

示例11: SND_Stop

BOOL SND_Stop(void)
{
    if(Nordic.isLoaded())
    {
        pFuncGetBool SND_Stop = (pFuncGetBool)Nordic.resolve("SND_Stop");
        if(SND_Stop)
        {
            return SND_Stop();
        }
    }
	return FALSE;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例12: NOR_Close

BOOL NOR_Close(void)
{
    if(Nordic.isLoaded())
    {
        pFuncGetBool NOR_Close = (pFuncGetBool)Nordic.resolve("NOR_Close");
        if(NOR_Close)
        {
            return NOR_Close();
        }
    }
	return FALSE;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例13: SND_Start

BOOL SND_Start(void)
{
    if(Nordic.isLoaded())
    {
        pFuncGetBool SND_Start = (pFuncGetBool)Nordic.resolve("SND_Start");
        if(SND_Start)
        {
            return SND_Start();
        }
    }
	return FALSE;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例14: SND_SendTxBuf

BOOL SND_SendTxBuf(UCHAR *ucTxBuf)
{
    if(Nordic.isLoaded())
    {
        pFuncGetBoolParamUCharPt SND_SendTxBuf = (pFuncGetBoolParamUCharPt)Nordic.resolve("SND_SendTxBuf");
        if(SND_SendTxBuf)
        {
            return SND_SendTxBuf(ucTxBuf);
        }
    }
	return FALSE;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例15: RTK_GetRxBuf

UCHAR* RTK_GetRxBuf(void)
{
    if(Nordic.isLoaded())
    {
        pFuncGetUCHARPt RTK_GetRxBuf = (pFuncGetUCHARPt)Nordic.resolve("RTK_GetRxBuf");
        if(RTK_GetRxBuf)
        {
            return RTK_GetRxBuf();
        }
    }
	return NULL;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp


注:本文中的QLibrary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。