本文整理汇总了C++中qputenv函数的典型用法代码示例。如果您正苦于以下问题:C++ qputenv函数的具体用法?C++ qputenv怎么用?C++ qputenv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qputenv函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: qunsetenv
void SettingsWidget::applyProxy()
{
Settings &QMPSettings = QMPlay2Core.getSettings();
if (!QMPSettings.getBool("Proxy/Use"))
{
qunsetenv("http_proxy");
}
else
{
const QString proxyHostName = QMPSettings.getString("Proxy/Host");
const quint16 proxyPort = QMPSettings.getInt("Proxy/Port");
QString proxyUser, proxyPassword;
if (QMPSettings.getBool("Proxy/Login"))
{
proxyUser = QMPSettings.getString("Proxy/User");
proxyPassword = QByteArray::fromBase64(QMPSettings.getByteArray("Proxy/Password"));
}
/* Proxy env for FFmpeg */
QString proxyEnv = QString("http://" + proxyHostName + ':' + QString::number(proxyPort));
if (!proxyUser.isEmpty())
{
QString auth = proxyUser;
if (!proxyPassword.isEmpty())
auth += ':' + proxyPassword;
auth += '@';
proxyEnv.insert(7, auth);
}
qputenv("http_proxy", proxyEnv.toLocal8Bit());
}
}
开发者ID:arthurzam,项目名称:QMPlay2,代码行数:31,代码来源:SettingsWidget.cpp
示例17: main
int main(int argc, char **argv)
{
QQuickWindow::setDefaultAlphaBuffer(true);
QApplication app(argc, argv);
app.setApplicationVersion(version);
app.setOrganizationDomain(QStringLiteral("audoban"));
app.setApplicationName(QStringLiteral("CandilDock"));
//! set pattern for debug messages
//! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}]
qSetMessagePattern(QStringLiteral(
CIGREEN "[%{type} " CGREEN "%{time h:mm:ss.zzzz}" CIGREEN "]" CNORMAL
#ifndef QT_NO_DEBUG
CIRED " [" CCYAN "%{function}" CIRED ":" CCYAN "%{line}" CIRED "]"
#endif
CICYAN " - " CNORMAL "%{message}"
CIRED "%{if-fatal}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}"
"%{if-warning}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}"
"%{if-critical}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}" CNORMAL));
qputenv("QT_QUICK_CONTROLS_1_STYLE", "Desktop");
Candil::DockCorona corona;
return app.exec();
}
开发者ID:audoban,项目名称:Candil-Dock,代码行数:26,代码来源:main.cpp
示例18: main
int main(int argc, char ** argv)
{
//the whole point of this is to interact with X, if we are in any other session, force trying to connect to X
//if the QPA can't load xcb, this app is useless anyway.
qputenv("QT_QPA_PLATFORM", "xcb");
QGuiApplication app(argc, argv);
if (app.platformName() != QLatin1String("xcb")) {
qFatal("xembed-sni-proxy is only useful XCB. Aborting");
}
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
app.setDesktopSettingsAware(false);
app.setQuitOnLastWindowClosed(false);
qDBusRegisterMetaType<KDbusImageStruct>();
qDBusRegisterMetaType<KDbusImageVector>();
qDBusRegisterMetaType<KDbusToolTipStruct>();
Xcb::atoms = new Xcb::Atoms();
FdoSelectionManager manager;
auto rc = app.exec();
delete Xcb::atoms;
return rc;
}
开发者ID:Matrix0xCC,项目名称:xembed-sni-proxy,代码行数:35,代码来源:main.cpp
示例19: QT_VERSION_CHECK
static const char *setHighDpiEnvironmentVariable() {
const char *envVarName = 0;
static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO";
#ifdef Q_OS_WIN
bool isWindows = true;
#else
bool isWindows = false;
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
if (isWindows
&& !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO)) {
envVarName = ENV_VAR_QT_DEVICE_PIXEL_RATIO;
qputenv(envVarName, "auto");
}
#else
if (isWindows
&& !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) // legacy in 5.6, but still functional
&& !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
#endif // < Qt 5.6
return envVarName;
}
开发者ID:Artiom-M,项目名称:xpiks,代码行数:29,代码来源:main.cpp
示例20: QApplication
Application::Application(int& argc, char** argv)
: QApplication(argc, argv),
m_window(0)
{
setApplicationName("FocusWriter");
setApplicationVersion("1.3.3");
setOrganizationDomain("gottcode.org");
setOrganizationName("GottCode");
{
QIcon fallback(":/hicolor/256x256/apps/focuswriter.png");
fallback.addFile(":/hicolor/128x128/apps/focuswriter.png");
fallback.addFile(":/hicolor/64x64/apps/focuswriter.png");
fallback.addFile(":/hicolor/48x48/apps/focuswriter.png");
fallback.addFile(":/hicolor/32x32/apps/focuswriter.png");
fallback.addFile(":/hicolor/24x24/apps/focuswriter.png");
fallback.addFile(":/hicolor/22x22/apps/focuswriter.png");
fallback.addFile(":/hicolor/16x16/apps/focuswriter.png");
setWindowIcon(QIcon::fromTheme("focuswriter", fallback));
}
#ifndef Q_WS_MAC
setAttribute(Qt::AA_DontUseNativeMenuBar);
setAttribute(Qt::AA_DontShowIconsInMenus, !QSettings().value("Window/MenuIcons", false).toBool());
#else
setAttribute(Qt::AA_DontShowIconsInMenus, true);
new RTF::Converter;
#endif
qputenv("UNICODEMAP_JP", "cp932");
m_files = arguments().mid(1);
processEvents();
}
开发者ID:svenna,项目名称:focuswriter,代码行数:32,代码来源:main.cpp
注:本文中的qputenv函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论