本文整理汇总了C++中QStringList::back方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::back方法的具体用法?C++ QStringList::back怎么用?C++ QStringList::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitStringContaingQuotes
/** given a text line containing fex [alpha beta "gamm ma" delta]
* split into a list of ["alpha", "beta" ,"gamm ma", "delta"]
*/
QStringList splitStringContaingQuotes(QString line)
{
QStringList base = line.split(" ");
QStringList retval;
for (int i=0; i<base.size(); ++i)
{
if (base[i].startsWith("\"") && !base[i].endsWith("\""))
{
QString s;
do
{
s += base[i];
if ((i+1)<base.size() && !base[i].endsWith("\""))
s += " ";
++i;
} while (i<base.size() && !base[i].endsWith("\""));
if (i<base.size())
s += base[i];
retval.push_back(s);
}
else
{
retval.push_back(base[i]);
}
retval.back() = retval.back().remove("\"");
}
retval.removeAll("");
return retval;
}
示例2: init
//----------------------------------------------------------------------------
void ctkPluginFrameworkContext::init()
{
log() << "initializing";
if (firstInit && ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT
== props[ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN])
{
deleteFWDir();
firstInit = false;
}
// Pre-load libraries
// This may speed up installing new plug-ins if they have dependencies on
// one of these libraries. It prevents repeated loading and unloading of the
// pre-loaded libraries during caching of the plug-in meta-data.
if (props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].isValid())
{
QStringList preloadLibs = props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].toStringList();
QLibrary::LoadHints loadHints;
QVariant loadHintsVariant = props[ctkPluginConstants::FRAMEWORK_PLUGIN_LOAD_HINTS];
if (loadHintsVariant.isValid())
{
loadHints = loadHintsVariant.value<QLibrary::LoadHints>();
}
foreach(QString preloadLib, preloadLibs)
{
QLibrary lib;
QStringList nameAndVersion = preloadLib.split(":");
QString libraryName;
if (nameAndVersion.count() == 1)
{
libraryName = nameAndVersion.front();
lib.setFileName(nameAndVersion.front());
}
else if (nameAndVersion.count() == 2)
{
libraryName = nameAndVersion.front() + "." + nameAndVersion.back();
lib.setFileNameAndVersion(nameAndVersion.front(), nameAndVersion.back());
}
else
{
qWarning() << "Wrong syntax in" << preloadLib << ". Use <lib-name>[:version]. Skipping.";
continue;
}
lib.setLoadHints(loadHints);
log() << "Pre-loading library" << lib.fileName() << "with hints [" << static_cast<int>(loadHints) << "]";
if (!lib.load())
{
qWarning() << "Pre-loading library" << lib.fileName() << "failed:" << lib.errorString() << "\nCheck your library search paths.";
}
}
示例3: format
int CodeEditer::format()
{
const QString code = this->toPlainText();
//const QString code = this->textCursor().selectedText();
if (code == QString::null)
return 1;
QStringList program = code.split(QLatin1Char('\n'), QString::KeepEmptyParts);
while (!program.isEmpty()) {
if (!program.back().trimmed().isEmpty())
break;
program.pop_back();
}
QStringList p;
QString out;
const QChar colon = QLatin1Char(':');
const QChar blank = QLatin1Char(' ');
const QChar newLine = QLatin1Char('\n');
QStringList::const_iterator cend = program.constEnd();
for (QStringList::const_iterator it = program.constBegin(); it != cend; ++it) {
p.push_back(*it);
QString &line = p.back();
QChar typedIn = Indenter::instance().firstNonWhiteSpace(line);
if (p.last().endsWith(colon))
typedIn = colon;
const int indent = Indenter::instance().indentForBottomLine(it, p.constBegin(), p.constEnd(), typedIn);
const QString trimmed = line.trimmed();
// Indent the line in the list so that the formatter code sees the indented line.
if (!trimmed.isEmpty()) {
line = QString(indent, blank);
line += trimmed;
}
out += line;
out += newLine ;
}
while (out.endsWith(newLine))
out.truncate(out.length() - 1 );
//fputs(out.toUtf8().constData(), stdout);
this->setPlainText(out);
return 0;
}
示例4: init
void CellRange::init(const QString &range)
{
// TODO can be range from one sheet to another, ex: "Sheet1:Sheet4!A1:A5" or "Sheet1:Sheet4!A1"
// TODO can be '!' or ':' symbol in sheet name
QStringList sp = range.split(QLatin1Char('!'));
QString cellRange = range;
if (sp.size() > 1) {
_sheet = sp.front();
if (_sheet.startsWith(QLatin1String("'")) && _sheet.endsWith(QLatin1String("'")))
_sheet = _sheet.mid(2, _sheet.length() - 2);
cellRange = sp.back();
}
QStringList rs = cellRange.split(QLatin1Char(':'));
if (rs.size() == 2) {
CellReference start(rs[0]);
CellReference end(rs[1]);
top = start.row();
left = start.column();
bottom = end.row();
right = end.column();
} else {
CellReference p(rs[0]);
top = p.row();
left = p.column();
bottom = p.row();
right = p.column();
}
}
示例5: submitJobs
void AddSessionDialog::submitJobs()
{
QSet<int> jobIds;
foreach(const QString &r, wJobRange->text().split(',')) {
QStringList range = r.split('-');
if(range.size() == 2) {
int low = range.front().toInt();
int high = range.back().toInt();
for(int jobId = low; jobId <= high; jobId++) {
jobIds.insert(jobId);
}
}
else if(range.size() == 1) {
jobIds.insert(range.front().toInt());
}
}
emit jobs_submitted(jobIds,
wImagePath->text(),
wNumCPUs->text().toInt(),
wMemory->text(),
wJobName->text(),
wStartupScript->toPlainText());
accept();
}
示例6: rowCount
bool Finder::rowCount(QXlsx::Document &schedule,int & lastRow)
{
for (int row=7; row<65536; ++row)
{
bool abort = m_abort;
if (abort) {
removeCopiedFiles();
emit finished(false);
return false;
}
if(QXlsx::Cell *cell=schedule.cellAt(row, 6))
{
if(cell->value() == QVariant("Masa"))
{
lastRow = row - 2;
break;
}
}
if(m_searchCriterion == "Others") {
if(QXlsx::Cell *cell=schedule.cellAt(row, 10))
if(!cell->value().toString().isEmpty()){
QStringList list = cell->value().toString().split(" ");
if(list.back()!="")m_copartnerSet.insert(cell->value().toString().toLower());
else m_copartnerSet.insert(cell->value().toString().toLower().replace(" ",""));
}
}
}
return true;
}
示例7: splitTarget
void OscapScannerRemoteSsh::splitTarget(const QString& in, QString& target, unsigned short& port)
{
// NB: We dodge a bullet here because the editor will always pass a port
// as the last component. A lot of checking and parsing does not need
// to be done.
//
// 'in' is in the format of [email protected]:port, the port always
// being there and always being the last component.
// FIXME: Ideally, this should split from the right side and stop after one split
QStringList split = in.split(':');
const QString portString = split.back();
split.removeLast();
{
bool status = false;
const unsigned short portCandidate = portString.toUShort(&status, 10);
// FIXME: Error reporting?
port = status ? portCandidate : 22;
}
target = split.join(":");
}
示例8: foreach
/// Fill the menu with plugin names and make connections
foreach(FilterPlugin* plugin, pluginManager()->filterPlugins()){
QAction* action = plugin->action();
QString pluginName = plugin->name();
QMenu * assignedMenu = mainWindow()->filterMenu;
// Check for categories
if(pluginName.contains("|")){
QStringList pluginNames = pluginName.split("|");
action->setText( pluginNames.back() );
// Try to locate exciting submenu
QString catName = pluginNames.front();
QMenu * m = assignedMenu->findChild<QMenu*>( catName );
if(!m) m = mainWindow()->filterMenu->addMenu(catName);
assignedMenu = m;
}
assignedMenu->addAction(action);
// Action refers to this filter, so we can retrieve it later
// QAction* action = new QAction(plugin->name(),plugin);
/// Does the filter have an icon? Add it to the toolbar
/// @todo add functionality to ModelFilter
if(!action->icon().isNull())
mainWindow()->filterToolbar->addAction(action);
/// Connect after it has been added
connect(action,SIGNAL(triggered()),this,SLOT(startFilter()));
}
示例9: formatComment
QString CommentFormatter::formatComment( const QString& comment ) {
QString ret;
int i = 0;
if( i > 1 ) {
ret = comment.mid( i );
} else {
///remove the star in each line
QStringList lines = comment.split( "\n", QString::KeepEmptyParts );
if( lines.isEmpty() ) return ret;
QStringList::iterator it = lines.begin();
QStringList::iterator eit = lines.end();
if( it != lines.end() ) {
for( ; it != eit; ++it ) {
strip( "//", *it );
strip( "**", *it );
rStrip( "/**", *it );
}
if( lines.front().trimmed().isEmpty() )
lines.pop_front();
if( !lines.isEmpty() && lines.back().trimmed().isEmpty() )
lines.pop_back();
}
ret = lines.join( "\n" );
}
return ret;
}
示例10: duplicateActiveNodeViz
void Model::duplicateActiveNodeViz(QString duplicationOp)
{
if(activeNode == nullptr) return;
tempNodes.clear();
// Check for grouping option
QStringList params = duplicationOp.split(",", QString::SkipEmptyParts);
if(params.empty()) return;
auto dups = makeDuplicates(activeNode, duplicationOp);
for(auto n : dups)
{
// Distinguish new nodes
auto color = n->vis_property["color"].value<QColor>();
color = color.lighter(50);
n->vis_property["color"].setValue(color);
tempNodes.push_back(QSharedPointer<Structure::Node>(n));
}
// Hide previous group during visualization
for(auto g : groupsOf(activeNode->id)){
for(auto nid : g){
if(nid == activeNode->id) continue;
getNode(nid)->vis_property["isHidden"].setValue(params.back() == "group");
}
}
}
示例11: slotTextChangedDelayed
void QuickOpenFunctionDialog::slotTextChangedDelayed() {
QString text = nameEdit->text();
QString txt = text;
QStringList parts = QStringList::split("::", text);
if(text.endsWith("::") || parts.isEmpty()) {
txt = "";
}else{
txt = parts.back();
parts.pop_back();
}
QValueList<QRegExp> regExpParts;
for( QStringList::const_iterator it = parts.begin(); it != parts.end(); ++it ) {
regExpParts << QRegExp( *it, false, true );
}
QString scope = parts.join("::");
if( m_scope != scope ) {
if( !scope.startsWith(m_scope) ) { ///Not a specialization, so reload all function-definitions
fillItemList();
}
if(!parts.isEmpty()) {
FunctionList accepted;
QStringList acceptedItems;
FunctionList::iterator it = m_functionDefList.begin();
while(it != m_functionDefList.end()) {
QStringList scope = (*it)->scope();
QValueList<QRegExp>::iterator mit = regExpParts.begin();
QStringList::iterator sit = scope.begin();
bool fail = false;
while(mit != regExpParts.end()) {
while(sit != scope.end() && !(*mit).exactMatch( *sit ) ) ++sit;
if(sit == scope.end()) {
fail = true;
break;
}
++mit;
}
if(!fail) {
accepted.append(*it);
acceptedItems << (*it)->name();
}
++it;
}
m_functionDefList = accepted;
m_items = acceptedItems;
QStringList_unique( m_items );
}
m_scope = scope;
}
itemList->clear();
itemList->insertStringList( wildCardCompletion( txt ) );
itemList->setCurrentItem(0);
}
示例12: prepare
bool OperationMetaData::prepare(const IOOptions&opt)
{
QString pcount = resource()["inparameters"].toString();
if ( pcount != "") {
QStringList parts = pcount.split("|");
_minInputCountParameters = parts.first().toInt();
quint16 maxCountParameters = parts.back().toInt();
parmfromResource(maxCountParameters,"pin");
}
pcount = resource()["outparameters"].toString();
if ( pcount != "") {
QStringList parts = pcount.split("|");
_minOutputCountParameters = parts.first().toInt();
quint16 maxCountParameters = parts.back().toInt();
parmfromResource(maxCountParameters,"pout");
}
return true;
}
示例13: getRootConfigPath
QString DataLocations::getRootConfigPath()
{
QStringList paths = getRootConfigPaths();
if (paths.empty())
return "";
// Those who ask for a single (legacy) config path need
// the default CX path, not the override.
return paths.back();
}
示例14: parameterEstimationAll
void MainWindow::parameterEstimationAll() {
ParameterEstimationDialog dlg;
if (!dlg.exec()) return;
loadCNNs();
QString segmentation_output_dir = dlg.ui.lineEditSegmentationOutputDirectory->text();
if (!QDir(segmentation_output_dir).exists()) {
QDir().mkdir(segmentation_output_dir);
}
QString initial_output_dir = dlg.ui.lineEditInitialOutputDirectory->text();
if (!QDir(initial_output_dir).exists()) {
QDir().mkdir(initial_output_dir);
}
QString final_output_dir = dlg.ui.lineEditOutputDirectory->text();
if (!QDir(final_output_dir).exists()) {
QDir().mkdir(final_output_dir);
}
QDir image_dir(dlg.ui.lineEditTestDataDirectory->text());
QStringList image_files = image_dir.entryList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst);
printf("Predicting: ");
for (int i = 0; i < image_files.size(); i++) {
printf("\rPredicting: %d", i + 1);
QStringList strs = image_files[i].split(".");
if (strs.back() != "png" && strs.back() != "jpg") continue;
std::vector<float> x_splits;
std::vector<float> y_splits;
std::vector<std::vector<fs::WindowPos>> win_rects;
cv::Mat segmentation_result;
cv::Mat initial_result;
cv::Mat final_result;
parseFacade(dlg.ui.lineEditTestDataDirectory->text() + "/" + image_files[i], x_splits, y_splits, win_rects, segmentation_result, initial_result, final_result);
cv::imwrite((segmentation_output_dir + "/" + strs[0] + ".png").toUtf8().constData(), segmentation_result);
cv::imwrite((initial_output_dir + "/" + strs[0] + ".png").toUtf8().constData(), initial_result);
cv::imwrite((final_output_dir + "/" + strs[0] + ".png").toUtf8().constData(), final_result);
}
printf("\n");
}
示例15: openMeshFile
void VertexBasedSegmenter::openMeshFile(string mname){
mesh = Mesh<Vertex3D, Triangle>();
QString qmn = QString::fromStdString(mname);
QStringList qsl = qmn.split(".");
if(!qsl.back().compare("tri"))
Reader::readMeshFile(mesh, mname);
else if(!qsl.back().compare("off"))
Reader::readOFFMesh(mesh, mname);
else{
cout<<"Not a valid file format (it must be .tri or .off)"<<endl;
exit(0);
}
mesh.build();
cout<<"Build mesh with "<<mesh.getNumVertex()<<" vertices and "<<mesh.getTopSimplexesNum()<<" triangles "<<endl;
}