本文整理汇总了C++中QStringList::toVector方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::toVector方法的具体用法?C++ QStringList::toVector怎么用?C++ QStringList::toVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::toVector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::vector<std::string> TestDialog::fromQStringList(QStringList s){
std::vector<QString> vqs = s.toVector().toStdVector();
std::vector<std::string> vs;
for(int i=0;i<(int)vqs.size();i++){
vs.push_back(vqs[i].toStdString());
}
return vs;
}
示例2: extraClangToolsPrependOptions
static QStringList extraClangToolsPrependOptions() {
constexpr char csaPrependOptions[] = "QTC_CLANG_CSA_CMD_PREPEND";
constexpr char toolsPrependOptions[] = "QTC_CLANG_TOOLS_CMD_PREPEND";
static const QStringList options = extraOptions(csaPrependOptions)
+ extraOptions(toolsPrependOptions);
if (!options.isEmpty())
qWarning() << "ClangTools options are prepended with " << options.toVector();
return options;
}
示例3: onLoad
/*
* slots
*/
void MainWindow::onLoad()
{
QStringList paths = QFileDialog::getOpenFileNames(this, "Choose your images", ".");
// setting the member variables
m_paths = paths.toVector().toStdVector();
m_cur_path = m_paths.begin();
// make the "next" button available if more than 1 image is loaded
if (m_paths.size() > 1)
ui->button_next->setEnabled(true);
ui->button_thresh->setEnabled(true);
emit pathChanged(*m_cur_path);
}
示例4: parseTuple
DemandTuple DemandListModel::parseTuple(QString const& csvText, QString const& sep, bool & ok){
DemandTuple rtuple;
ok = true;
if(csvText == ""){
ok = false;
return rtuple;
}
QStringList strings = csvText.split(sep);
if(strings.size() < columnCount()-1){//csv line don't match the numbers of elements.
ok = false;
return rtuple;
}
rtuple.names = strings.first();
strings.pop_front();
//Order of demands.
rtuple.preferences = QVector<int>(_numberOfChoices, noChoice);
for(unsigned int i = 0; i < _numberOfChoices; i++){
QString c = strings.first();
bool ok;
int v = QVariant(c).toInt(&ok);
if(ok){
rtuple.preferences[i] = v;
}
strings.pop_front();
}
//additional vars
rtuple.additionalVars = strings.toVector();
return rtuple;
}
示例5: start
void PosixSpawn::start(const QString &program,
const QStringList &arguments,
QIODevice::OpenMode mode)
{
int rc;
char *file = strdup(program.toLocal8Bit().data());
size_t sz = arguments.count()+2;
char * argv[sz];
memset(argv, 0, sizeof(*argv)*sz);
posix_spawn_file_actions_t file_actions;
posix_spawnattr_t attr;
posix_spawn_file_actions_init(&file_actions);
posix_spawnattr_init(&attr);
#ifndef Q_OS_OSX
/* os X doesn't support posix spawn with vfork flag
* I hope it's implementation is still based on it
* since the syscall exists
*/
posix_spawnattr_setflags(&attr, POSIX_SPAWN_USEVFORK);
#endif
int peer[2] = { -1, -1 };
if ( mode & QIODevice::ReadOnly) {
int p[2];
rc = pipe(p);
if ( rc < 0 ) {
dflError("pipe(read) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
impl->channels[0] = p[0];
rc = posix_spawn_file_actions_adddup2(&file_actions,
p[1],
STDOUT_FILENO);
peer[1] = p[1];
if ( rc < 0 ) {
dflError("posix_spawn_file_actions_adddup2(stdout) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
}
else {
rc = posix_spawn_file_actions_addopen(&file_actions,
STDOUT_FILENO,
"/dev/null",
O_WRONLY, 0);
if ( rc < 0 ) {
dflError("posix_spawn_file_actions_addopen(stdout) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
}
if ( mode & QIODevice::WriteOnly) {
int p[2];
rc = pipe(p);
if ( rc < 0 ) {
dflError("pipe(write) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
impl->channels[1] = p[1];
rc = posix_spawn_file_actions_adddup2(&file_actions,
p[0],
STDIN_FILENO);
peer[0] = p[0];
if ( rc < 0 ) {
dflError("posix_spawn_file_actions_adddup2(stdin) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
}
else {
rc = posix_spawn_file_actions_addopen(&file_actions,
STDIN_FILENO,
"/dev/null",
O_RDONLY, 0);
if ( rc < 0 ) {
dflError("posix_spawn_file_actions_addopen(stdin) failed, errno=%s", strerror(errno));
impl->error=true;
return;
}
}
QVector<QString> args = arguments.toVector();
argv[0] = strdup(file);
for ( int i = 0 ; i < args.count() ; ++i ) {
argv[i+1] = strdup(args[i].toLocal8Bit().data());
}
argv[args.count()+1] = 0;
QString debugString = "cmd:";
for ( char **p = argv ; *p ; ++p ) {
debugString += " ";
debugString += *p ;
}
dflDebug(debugString);
debugString = "environ:";
for ( char **p = __environ ; *p ; ++p ) {
debugString += " ";
//.........这里部分代码省略.........