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


C++ qputenv函数代码示例

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


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

示例1: gridUnitEnvironmentVariable

 void gridUnitEnvironmentVariable() {
     QByteArray gridUnit = QString::number(11).toLocal8Bit();
     qputenv("GRID_UNIT_PX", gridUnit);
     UCUnits units;
     QCOMPARE(units.gridUnit(), 11.0);
     qputenv("GRID_UNIT_PX", "");
 }
开发者ID:Aleskey78,项目名称:ubuntu-ui-toolkit-win,代码行数:7,代码来源:tst_units.cpp

示例2: dir

void IQmolApplication::initOpenBabel()
{
   QDir dir(QApplication::applicationDirPath());
   QString path;

#ifdef Q_OS_MAC
   // Assumed directory structure: IQmol.app/Contents/MacOS/IQmol
   dir.cdUp();  
   path = dir.absolutePath();
   QApplication::addLibraryPath(path + "/Frameworks");
   QApplication::addLibraryPath(path + "/PlugIns");
#endif

#ifdef Q_OS_WIN32
   // Assumed directory structure: IQmol/bin/IQmol
   dir.cdUp();  
   path = dir.absolutePath();
   QApplication::addLibraryPath(path + "/lib");
   QApplication::addLibraryPath(path + "/lib/plugins");
#endif

#ifdef Q_OS_LINUX
   // Assumed directory structure: IQmol/IQmol
   // This is so that when the executable is created it can be 
   // run from the main IQmol directory 
   path = dir.absolutePath();
   QApplication::addLibraryPath(path + "/lib");
   QApplication::addLibraryPath(path + "/lib/plugins");
#endif
   

   // This is not used any more as we ship with a static
   // version of OpenBabel
   QString env(qgetenv("BABEL_LIBDIR"));
   if (env.isEmpty()) {
      env = path + "/lib/openbabel";
      qputenv("BABEL_LIBDIR", env.toLatin1());
      QLOG_INFO() << "Setting BABEL_LIBDIR = " << env;
   }else {
      QLOG_INFO() << "BABEL_LIBDIR already set: " << env;
   }

   env = qgetenv("BABEL_DATADIR");
   if (env.isEmpty()) {
#if defined(Q_OS_LINUX)
      // Overide the above for the deb package installation.
      env ="/usr/share/iqmol/openbabel";
#else
      env = path + "/share/openbabel";
#endif
      qputenv("BABEL_DATADIR", env.toLatin1());
      QLOG_INFO() << "Setting BABEL_DATADIR = " << env;
   }else {
      QLOG_INFO() << "BABEL_DATADIR already set: " << env;
   }


}
开发者ID:nutjunkie,项目名称:IQmol,代码行数:58,代码来源:IQmolApplication.C

示例3: dir

void IQmolApplication::initOpenBabel()
{
   QDir dir(QApplication::applicationDirPath());
   dir.cdUp();  
   QString path(dir.absolutePath());

#ifdef Q_WS_MAC
   // Assumed directory structure: IQmol.app/Contents/MacOS/IQmol
   QApplication::addLibraryPath(path + "/Frameworks");
   QApplication::addLibraryPath(path + "/PlugIns");
#else
   // Assumed directory structure: IQmol-xx/bin/IQmol
   QApplication::addLibraryPath(path + "/lib");
   QApplication::addLibraryPath(path + "/lib/plugins");
#endif

#ifdef Q_OS_LINUX
   return;
#endif

   QString env(qgetenv("BABEL_LIBDIR"));
   if (env.isEmpty()) {
      env = path + "/lib/openbabel";
      qputenv("BABEL_LIBDIR", env.toAscii());
      QLOG_INFO() << "Setting BABEL_LIBDIR = " << env;
   }else {
      QLOG_INFO() << "BABEL_LIBDIR already set: " << env;
   }

   env = qgetenv("BABEL_DATADIR");
   if (env.isEmpty()) {
      env = path + "/share/openbabel";
      qputenv("BABEL_DATADIR", env.toAscii());
      QLOG_INFO() << "Setting BABEL_DATADIR = " << env;
   }else {
      QLOG_INFO() << "BABEL_DATADIR already set: " << env;
   }

#ifdef Q_WS_WIN
   QLibrary openBabel("libopenbabel.dll");
#else
   QLibrary openBabel("openbabel");
#endif

   if (!openBabel.load()) {
      QString msg("Could not load library ");
      msg += openBabel.fileName();

      QLOG_ERROR() << msg << " " << openBabel.errorString();
      QLOG_ERROR() << "Library Paths:";
      QLOG_ERROR() << libraryPaths();

      msg += "\n\nPlease ensure the OpenBabel libraries have been installed correctly";
      QMsgBox::critical(0, "IQmol", msg);
      QApplication::quit();
      return;
   }
}
开发者ID:bjnano,项目名称:IQmol,代码行数:58,代码来源:IQmolApplication.C

示例4: qputenv

void TestContactsd::envTest()
{
    qputenv("CONTACTSD_PLUGINS_DIRS", "/usr/lib/contactsd-1.0/plugins/:/usr/lib/contactsd-1.0/plgins/");
    mLoader->loadPlugins(QStringList());
    QVERIFY2(mLoader->loadedPlugins().count() > 0, "failed to load plugins from evn variable");
    qDebug() << mLoader->loadedPlugins();
    qputenv("CONTACTSD_PLUGINS_DIRS", "");
    mLoader->loadPlugins(QStringList());
}
开发者ID:SamuelNevala,项目名称:contactsd,代码行数:9,代码来源:test-contactsd.cpp

示例5: QString

void ProxyManager::set()
{
    QByteArray envvar = QString("http://%1:%2").arg(this->_host, QString::number(this->_port)).toUtf8();

    qputenv("http_proxy", envvar);
    qputenv("https_proxy", envvar);
    qputenv("ftp_proxy", envvar);
    qputenv("rsync_proxy", envvar);
}
开发者ID:Dax89,项目名称:harbour-webpirate,代码行数:9,代码来源:proxymanager.cpp

示例6: path

void TestContactsd::importNonPlugin()
{
    /* This is just a coverage test */
    const QString path(QDir::currentPath() + "/data/");
    qputenv("CONTACTSD_PLUGINS_DIRS", path.toAscii());
    mLoader->loadPlugins(QStringList());
    QStringList pluginList = mLoader->loadedPlugins();
    QCOMPARE(pluginList.size(), 0);
    qputenv("CONTACTSD_PLUGINS_DIRS", "");
}
开发者ID:SamuelNevala,项目名称:contactsd,代码行数:10,代码来源:test-contactsd.cpp

示例7: qgetenv

void tst_QGetPutEnv::getSetCheck()
{
    const char* varName = "should_not_exist";
    QByteArray result = qgetenv(varName);
    QCOMPARE(result, QByteArray());
    QVERIFY(qputenv(varName, QByteArray("supervalue")));
    result = qgetenv(varName);
    QVERIFY(result == "supervalue");
    qputenv(varName,QByteArray());
}
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:10,代码来源:tst_qgetputenv.cpp

示例8: do_common_options_before_qapp

void do_common_options_before_qapp(const QOptions& options)
{
    // it's too late if qApp is created. but why ANGLE is not?
    if (options.value(QString::fromLatin1("egl")).toBool() || Config::instance().isEGL()) {
        // only apply to current run. no config change
        qputenv("QT_XCB_GL_INTEGRATION", "xcb_egl");
    } else {
        qputenv("QT_XCB_GL_INTEGRATION", "xcb_glx");
    }
    qDebug() << "QT_XCB_GL_INTEGRATION: " << qgetenv("QT_XCB_GL_INTEGRATION");
}
开发者ID:ericma2014,项目名称:QtAV,代码行数:11,代码来源:common.cpp

示例9: main

int main(int argc, char *argv[])
{
    qputenv("GTK_IM_MODULE", QByteArray("qimsys"));
    qputenv("QT_IM_MODULE", QByteArray("qimsys"));
    QApplication app(argc, argv);

    MainWindow mainWindow;
    mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
    mainWindow.showExpanded();

    return app.exec();
}
开发者ID:qt-users-jp,项目名称:qimsys,代码行数:12,代码来源:main.cpp

示例10: main

int main(int argc, char *argv[])
{
    /* Disable rwx memory.
       This will also ensure full PAX/Grsecurity protections. */
    qputenv("QV4_FORCE_INTERPRETER",  "1");
    qputenv("QT_ENABLE_REGEXP_JIT",   "0");

    QApplication a(argc, argv);
    a.setApplicationVersion(QLatin1String("1.1.2"));
    a.setOrganizationName(QStringLiteral("Ricochet"));

#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
    a.setWindowIcon(QIcon(QStringLiteral(":/icons/ricochet.svg")));
#endif

    QScopedPointer<SettingsFile> settings(new SettingsFile);
    SettingsObject::setDefaultFile(settings.data());

    QString error;
    QLockFile *lock = 0;
    if (!initSettings(settings.data(), &lock, error)) {
        QMessageBox::critical(0, qApp->translate("Main", "Ricochet Error"), error);
        return 1;
    }
    QScopedPointer<QLockFile> lockFile(lock);

    initTranslation();

    /* Initialize OpenSSL's allocator */
    CRYPTO_malloc_init();

    /* Seed the OpenSSL RNG */
    if (!SecureRNG::seed())
        qFatal("Failed to initialize RNG");
    qsrand(SecureRNG::randomInt(UINT_MAX));

    /* Tor control manager */
    Tor::TorManager *torManager = Tor::TorManager::instance();
    torManager->setDataDirectory(QFileInfo(settings->filePath()).path() + QStringLiteral("/tor/"));
    torControl = torManager->control();
    torManager->start();

    /* Identities */
    identityManager = new IdentityManager;
    QScopedPointer<IdentityManager> scopedIdentityManager(identityManager);

    /* Window */
    QScopedPointer<MainWindow> w(new MainWindow);
    if (!w->showUI())
        return 1;

    return a.exec();
}
开发者ID:ghostlands,项目名称:ricochet,代码行数:53,代码来源:main.cpp

示例11: QStringLiteral

void SessionManager::setupEnvironment()
{
    // Set paths only if we are installed onto a non standard location
    QString path;

    if (qEnvironmentVariableIsSet("PATH")) {
        path = QStringLiteral("%1:%2").arg(INSTALL_BINDIR).arg(QString(qgetenv("PATH")));
        qputenv("PATH", path.toUtf8());
    }

    if (qEnvironmentVariableIsSet("QT_PLUGIN_PATH")) {
        path = QStringLiteral("%1:%2").arg(INSTALL_PLUGINDIR).arg(QString(qgetenv("QT_PLUGIN_PATH")));
        qputenv("QT_PLUGIN_PATH", path.toUtf8());
    }

    if (qEnvironmentVariableIsSet("QML2_IMPORT_PATH")) {
        path = QStringLiteral("%1:%2").arg(INSTALL_QMLDIR).arg(QString(qgetenv("QML2_IMPORT_PATH")));
        qputenv("QML2_IMPORT_PATH", path.toUtf8());
    }

    if (qEnvironmentVariableIsSet("XDG_DATA_DIRS")) {
        path = QStringLiteral("%1:%2").arg(INSTALL_DATADIR).arg(QString(qgetenv("XDG_DATA_DIRS")));
        qputenv("XDG_DATA_DIRS", path.toUtf8());
    }

    if (qEnvironmentVariableIsSet("XDG_CONFIG_DIRS")) {
        path = QStringLiteral("%1:%2:/etc/xdg").arg(INSTALL_CONFIGDIR).arg(QString(qgetenv("XDG_CONFIG_DIRS")));
        qputenv("XDG_CONFIG_DIRS", path.toUtf8());
    }

    if (qEnvironmentVariableIsSet("XCURSOR_PATH")) {
       path = QStringLiteral("%1:%2").arg(INSTALL_DATADIR "/icons").arg(QString(qgetenv("XCURSOR_PATH")));
        qputenv("XCURSOR_PATH", path.toUtf8());
    }

    // Set XDG environment variables
    if (qEnvironmentVariableIsEmpty("XDG_DATA_HOME")) {
        QString path = QStringLiteral("%1/.local/share").arg(QString(qgetenv("HOME")));
        qputenv("XDG_DATA_HOME", path.toUtf8());
    }
    if (qEnvironmentVariableIsEmpty("XDG_CONFIG_HOME")) {
        QString path = QStringLiteral("%1/.config").arg(QString(qgetenv("HOME")));
        qputenv("XDG_CONFIG_HOME", path.toUtf8());
    }

    // Set platform integration
    qputenv("SAL_USE_VCLPLUGIN", QByteArray("kde"));
//    qputenv("QT_PLATFORM_PLUGIN", QByteArray("Material"));
//    qputenv("QT_QPA_PLATFORMTHEME", QByteArray("Material"));
//    qputenv("QT_QUICK_CONTROLS_STYLE", QByteArray("Material"));
    // qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", QByteArray("1"));
//    qputenv("XDG_CURRENT_DESKTOP", QByteArray("U2T"));
//    qputenv("XCURSOR_THEME", QByteArray("Adwaita"));
//    qputenv("XCURSOR_SIZE", QByteArray("16"));
}
开发者ID:JosephMillsAtWork,项目名称:u2t,代码行数:55,代码来源:sessionmanager.cpp

示例12: qputenv

void CompositorLauncher::setupEnvironment()
{
    // Make clients run on Wayland
    if (m_hardware == BroadcomHardware) {
        qputenv("QT_QPA_PLATFORM", QByteArray("wayland-brcm"));
        qputenv("QT_WAYLAND_HARDWARE_INTEGRATION", QByteArray("brcm-egl"));
        qputenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION", QByteArray("brcm-egl"));
    } else {
        qputenv("QT_QPA_PLATFORM", QByteArray("wayland"));
    }
    qputenv("GDK_BACKEND", QByteArray("wayland"));
    
    qunsetenv("WAYLAND_DISPLAY");
}
开发者ID:JosephMillsAtWork,项目名称:u2t,代码行数:14,代码来源:compositorlauncher.cpp

示例13: main

int main(int argc, char *argv[])
{
#if defined(Q_WS_X11)
    QApplication::setGraphicsSystem("raster");
#elif defined (Q_WS_WIN)
    qputenv("QML_ENABLE_TEXT_IMAGE_CACHE", "true");
#endif

#if defined(Q_WS_S60)
    QApplication app(argc, argv);
#else
    // Check for single running instance    
    QtSingleApplication app(argc, argv);
    if (app.isRunning()) {
        app.sendMessage("FOREGROUND");
        return 0;
    }
#endif

    DuktoWindow viewer;
#ifndef Q_WS_S60
    app.setActivationWindow(&viewer, true);
#endif
    GuiBehind gb(&viewer);
    viewer.showExpanded();
    app.installEventFilter(&gb);

    return app.exec();
}
开发者ID:home201448,项目名称:dukto-1,代码行数:29,代码来源:main.cpp

示例14: initPython

void initPython()
{
    //init python
    qputenv("PYTHONIOENCODING", "utf-8");
    Py_Initialize();
    if (!Py_IsInitialized())
    {
        qDebug("Cannot initialize python.");
        exit(-1);
    }

    //init module
    geturl_obj = new GetUrl(qApp);
#if PY_MAJOR_VERSION >= 3
    apiModule = PyModule_Create(&moonplayerModule);
    PyObject *modules = PySys_GetObject("modules");
    PyDict_SetItemString(modules, "moonplayer", apiModule);
#else
    apiModule = Py_InitModule("moonplayer", methods);
#endif

    PyModule_AddStringConstant(apiModule, "final_url", "");
    Py_IncRef(exc_GetUrlError);
    PyModule_AddObject(apiModule, "GetUrlError", exc_GetUrlError);

    // plugins' dir
    PyRun_SimpleString("import sys");
    PyRun_SimpleString(QString("sys.path.insert(0, '%1/plugins')").arg(getAppPath()).toUtf8().constData());
    PyRun_SimpleString(QString("sys.path.append('%1/plugins')").arg(getUserPath()).toUtf8().constData());
}
开发者ID:coslyk,项目名称:moonplayer,代码行数:30,代码来源:pyapi.cpp

示例15: main

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    SignalHandler signalHandler;
    Q_UNUSED(signalHandler)

    if (QCoreApplication::arguments().length() < 2)
        qFatal("Specify superuser user-id.");

    bool ok;
    auto headadminId = QCoreApplication::arguments()[1].toLongLong(&ok);

    if (!ok)
        qFatal("Specify superuser user-id.");

    app.setApplicationName("Telegram-Bot");
    app.setApplicationVersion(Bot::version());

    //qputenv("QT_LOGGING_RULES", "tg.*=false");
    qputenv("QT_LOGGING_RULES", "tg.*=false\nbot.*.debug=false");
    //qputenv("DEBUG", "true");

    Database database;

    Bot bot(&database, headadminId);
    bot.installModule(new Board);
    bot.installModule(new Help);
    bot.installModule(new Subscribe);
    bot.installModule(new ConfigModule);
    bot.installModule(new GroupModule);
    bot.init();

    return app.exec();
}
开发者ID:shervinkh,项目名称:telegrambot,代码行数:35,代码来源:main.cpp


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