本文整理汇总了C++中QProcess::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::setObjectName方法的具体用法?C++ QProcess::setObjectName怎么用?C++ QProcess::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcess
的用法示例。
在下文中一共展示了QProcess::setObjectName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadConfigs
void MainWindow::loadConfigs(QString path)
{
if (!QFile(path).exists()) {
QMessageBox::warning(this, tr("Ошибка открытия файла"),
tr("Не найден файл настроек gostunnel:\n") + path);
return;
}
ui->lwGroups->clear();
connections.clear();
QStringList groups;
QSettings st(path, QSettings::IniFormat);
groups << st.childGroups();
for (int i = 0; i < groups.count(); i++) {
QProcess *proc = new QProcess(this);
proc->setObjectName(groups.at(i));
connections.insert(groups.at(i), proc);
QListWidgetItem *item = new QListWidgetItem(groups.at(i),
ui->lwGroups);
}
if (!groups.isEmpty()) {
ui->lwGroups->item(0)->setSelected(true);
loadConfig(groups.first());
}
}
示例2: on_btnAddGroup_clicked
void MainWindow::on_btnAddGroup_clicked()
{
QString name = "Connection" + searchFreeNumber(connections.keys(),
QString("Connection"));
QString label = tr("Введите название нового подключения");
bool ok = false;
QList<QListWidgetItem *> list = ui->lwGroups->findItems(name, Qt::MatchWrap);
while (true) {
name = QInputDialog::getText(
this,
tr("Ввод названия нового подключения"),
label, QLineEdit::Normal, name, &ok);
list = ui->lwGroups->findItems(name, Qt::MatchWrap);
if (ok && list.count() > 0) {
label = tr("Подключение с таким названием уже существует!\n"
"Введите другое название");
name = "Connection" + searchFreeNumber(connections.keys(),
QString("Connection"));
} else if (ok) {
break;
} else {
return;
}
}
QProcess *proc = new QProcess(this);
proc->setObjectName(name);
connections.insert(name, proc);
QListWidgetItem *item = new QListWidgetItem(name);
ui->lwGroups->addItem(item);
ui->lwGroups->setCurrentItem(item);
loadConfig(name);
}
示例3: on_lwGroups_doubleClicked
void MainWindow::on_lwGroups_doubleClicked(const QModelIndex &index)
{
if (connections.value(index.data().toString())->pid() > 0) {
QMessageBox::information(this,
tr("Невозможно изменить имя подключения"),
tr("В настоящее время подключение активно, "
"остановите подключение для изменения настроек"));
} else {
QString oldName = index.data().toString();
QString newName = oldName;
QString label = tr("Введите новое название подключения:");
bool ok = false;
QList<QListWidgetItem *> list;
while (true) {
newName = QInputDialog::getText(
this,
tr("Изменение названия подключения"),
label, QLineEdit::Normal, newName, &ok);
list = ui->lwGroups->findItems(newName, Qt::MatchWrap);
if (ok && list.count() > 0) {
if (newName == oldName) {
return;
}
label = tr("Подключение с таким названием уже существует!\n"
"Введите другое название:");
newName = oldName;
} else if (newName.contains(QRegExp("\\w*[\\.\\s\\,]+\\w*"))) {
label = tr("Некорректное название подключение!\n"
"Строка содержит неподдерживаемые символы\n"
"Введите другое название:");
newName = oldName;
} else if (ok) {
break;
} else {
return;
}
}
ui->lwGroups->currentItem()->setText(newName);
QProcess *proc = connections.value(oldName);
proc->setObjectName(newName);
connections.insert(newName, proc);
connections.remove(oldName);
deleteConfig(oldName);
saveConfig(newName);
}
}
示例4: SIGNAL
QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
const QString &puppetMode,
const QString &socketToken,
QObject *handlerObject,
const char *outputSlot,
const char *finishSlot) const
{
QProcess *puppetProcess = new QProcess;
puppetProcess->setObjectName(puppetMode);
puppetProcess->setProcessEnvironment(processEnvironment());
QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill()));
QObject::connect(puppetProcess, SIGNAL(finished(int,QProcess::ExitStatus)), handlerObject, finishSlot);
bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty();
if (fowardQmlpuppetOutput) {
puppetProcess->setProcessChannelMode(QProcess::MergedChannels);
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
}
puppetProcess->start(puppetPath, QStringList() << socketToken << puppetMode << "-graphicssystem raster");
return puppetProcess;
}
示例5: runInSofa
//.........这里部分代码省略.........
std::string viewerExtension;
if (!viewerName.empty())
viewerExtension += "." + viewerName;
viewerExtension += ".view";
viewFile += viewerExtension;
if ( !sofa::helper::system::DataRepository.findFile ( viewFile ) )
{
viewFile = sceneFilename+".view";
viewerExtension = ".view";
}
// std::cerr << "viewFile = " << viewFile << std::endl;
if ( sofa::helper::system::DataRepository.findFile ( viewFile ) )
{
std::ifstream originalViewFile(viewFile.c_str());
const std::string nameCopyViewFile(path + std::string("temp") + count + ".scn" + viewerExtension );
std::ofstream copyViewFile(nameCopyViewFile.c_str());
std::string line;
while (std::getline(originalViewFile, line)) copyViewFile << line << "\n";
copyViewFile.close();
originalViewFile.close();
}
}
if (count > '9') count = '0';
QString messageLaunch;
QStringList argv;
//=======================================
// Run Sofa
if (sofaBinary.empty()) //If no specific binary is specified, we use runSofa
{
std::string binaryName="runSofa";
#ifndef NDEBUG
binaryName+="_d";
#endif
#ifdef WIN32
sofaBinary = binPath + binaryName + ".exe";
#else
sofaBinary = binPath + binaryName;
#endif
}
argv << QString(filename.c_str());
messageLaunch = QString("Use command: ")
+ QString(sofaBinary.c_str())
+ QString(" ");
//Setting the GUI
for (unsigned int i=0; i<listActionGUI.size(); ++i)
{
if (listActionGUI[i]->isChecked())
{
if (std::string(listActionGUI[i]->text().toStdString()) != "default")
{
argv << "-g" << listActionGUI[i]->text();
messageLaunch += QString("-g ") + QString(listActionGUI[i]->text());
}
break;
}
}
//retrive plugins
typedef sofa::helper::system::PluginManager::PluginMap PluginMap;
PluginMap& pluginMap = PluginManager::getInstance().getPluginMap();
PluginManager::PluginIterator it;
for( it = pluginMap.begin(); it != pluginMap.end(); ++it )
{
argv << "-l" << QString((it->first).c_str()) << " ";
messageLaunch += QString("-l ") + QString((it->first).c_str());
}
argv << "-t";
QProcess *p = new QProcess(this);
p->setWorkingDirectory(QString(binPath.c_str()) );
p->setObjectName(QString(filename.c_str()) );
connect(p, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(sofaExited(int, QProcess::ExitStatus)));
QDir dir(QString(sofa::helper::system::SetDirectory::GetParentDir(sceneFilename.c_str()).c_str()));
connect(p, SIGNAL( readyReadStandardOutput () ), this , SLOT ( redirectStdout() ) );
connect(p, SIGNAL( readyReadStandardError () ), this , SLOT ( redirectStderr() ) );
p->start(QString(sofaBinary.c_str()), argv);
mapSofa.insert(std::make_pair(tabGraph, p));
statusBar()->showMessage(messageLaunch,5000);
}