本文整理汇总了C++中QStringList::pop_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::pop_back方法的具体用法?C++ QStringList::pop_back怎么用?C++ QStringList::pop_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::pop_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChatUser
QMap<QString, shared_ptr<ChatUser> >
ConnectorOld::parseChatUsers(QStringList recvMessage)
{
QMap<QString, shared_ptr<ChatUser> > users;
QString channelId = recvMessage.at(0);
recvMessage.pop_front(); // Remove channelId
QStringList usersList = recvMessage.join("\t").split("\r");
usersList.pop_back(); // Remove empty string
QStringList::const_iterator it;
for (it = usersList.constBegin(); it != usersList.constEnd(); ++it)
{
QStringList user = (*it).split('\t');
shared_ptr<ChatUser> us(
new ChatUser(
this,
channelId,
user.at(0),
user.at(1),
user.at(2),
user.at(3)));
users.insert(us->id(), us);
}
return users;
}
示例2: loadFile
void MainWindow::loadFile()
{
QString fullFilePath = QFileDialog::getOpenFileName(this,
tr("Open Material Script"), "./", tr("Material scripts (*.material )"));
if ( fullFilePath.isEmpty() ) { // If no file is loaded
return ;
}
QString fileName = fullFilePath.section('/', -1);
ui->textEdit->openFile(fullFilePath);
this->ui->wMat->setWindowTitle("Material Editor: " + fileName);
QStringList places = fullFilePath.split("/");
places.pop_back();
QString pathOnly = places.join("/");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation( pathOnly.toStdString() ,"FileSystem","mm");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("mm");
ui->listWidget->clear();
// QStringList materials = ui->OgreWidget->manager->getMaterialList();
//ui->listWidget->addItems(materials);
}
示例3: 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;
}
示例4: update_listView
void CelereMonitor::update_listView()
{
std::ifstream input("temp.txt",std::ios::in);
std::string output;
mioParser::parse(input,output,lineEditCode->text().toStdString(),3);
QString finalOut;
finalOut += QString::fromStdString(output);
input.close();
if(finalOut.contains("Attenzione!", Qt::CaseInsensitive)>0)
{
QMessageBox::information(this,tr("Attenzione"),tr("Informazione non ancora disponibile o codice inserito errato.<br>Controllare l'esattezza dei dati ed eventualmente riprovare più tardi."));
//.arg(finalOut));
//this->groupBoxResponse->setEnabled(false);
}
else if(finalOut.contains("momento", Qt::CaseInsensitive)>0)
QMessageBox::information(this,tr("Attenzione"),tr("Il servizio non è al momento disponibile.<BR>Riprovare nuovamente più tardi."));
else
{
//this->groupBoxResponse->setEnabled(true);
QStringList rows = finalOut.split("\n");
rows.pop_back();
rows.pop_front();
for (QStringList::Iterator it = rows.begin(); it != rows.end(); ++it )
{
QStringList cols = (*it).split("\t");
new QTreeWidgetItem(listViewResponse,cols);
}
}
QFile fi("temp.txt");
if(fi.exists()) fi.remove();
}
示例5: addFilePath
bool DubProjectNode::addFilePath(const QString &path)
{
#if QTCREATOR_MINOR_VERSION < 4
QString relativePath = QDir(QFileInfo(this->path()).path()).relativeFilePath(path);
#else
QString relativePath = QDir(QFileInfo(this->path().toString()).path()).relativeFilePath(path);
#endif
QStringList subpaths = relativePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
subpaths.pop_back();
// simply add all structure to node
ProjectExplorer::FolderNode* node = this;
typedef QList<ProjectExplorer::FolderNode *> SubFolders;
foreach (const QString& s, subpaths) {
SubFolders nodes = node->subFolderNodes();
NodeEqualPred pred(s);
SubFolders::iterator it = std::find_if(nodes.begin(), nodes.end(), pred);
if (it == nodes.end()) {
SubFolders list;
#if QTCREATOR_MINOR_VERSION < 4
ProjectExplorer::FolderNode* added = new ProjectExplorer::FolderNode(s);
#else
ProjectExplorer::FolderNode* added = new ProjectExplorer::FolderNode(Utils::FileName::fromString(s));
#endif
list.push_back(added);
node->addFolderNodes(list);
node = added;
} else {
node = *it;
}
}
示例6: createShowColumnsProperty
void TreeItemModel::createShowColumnsProperty()
{
QStringList range = QStringList() << "color" << "vg0" << "vg1" << "vg2" << "vg3";
QStringList defvals = range;
defvals.pop_back();
defvals.pop_back();
std::map<QString, QString> names;
names["color"] = "Color";
for (unsigned i=0; i<4; ++i)
names[QString("vg%1").arg(i)] = QString("View Group %1").arg(i);
// QStringList range = QStringList() << "Color"
// << "View Group 0"
// << "View Group 1"
// << "View Group 2"
// << "View Group 3";
mShowColumnsProperty = StringListProperty::initialize("visible_columns",
"Columns",
"Select visible columns",
range,
range,
mOptions.getElement());
mShowColumnsProperty->setDisplayNames(names);
connect(mShowColumnsProperty.get(), &Property::changed, this, &TreeItemModel::onShowColumnsChanged);
}
示例7: findExecutableFromName
static QString findExecutableFromName(const QString &fileNameFromCore, const QString &coreFile)
{
if (QFileInfo(fileNameFromCore).isFile())
return fileNameFromCore;
if (fileNameFromCore.isEmpty())
return QString();
// turn the filename into an absolute path, using the location of the core as a hint
QString absPath;
QFileInfo fi(fileNameFromCore);
if (fi.isAbsolute()) {
absPath = fileNameFromCore;
} else {
QFileInfo coreInfo(coreFile);
QDir coreDir = coreInfo.dir();
absPath = FileUtils::resolvePath(coreDir.absolutePath(), fileNameFromCore);
}
if (QFileInfo(absPath).isFile() || absPath.isEmpty())
return absPath;
// remove possible trailing arguments
QLatin1Char sep(' ');
QStringList pathFragments = absPath.split(sep);
while (pathFragments.size() > 0) {
QString joined_path = pathFragments.join(sep);
if (QFileInfo(joined_path).isFile()) {
return joined_path;
}
pathFragments.pop_back();
}
return QString();
}
示例8: requestVideoList
QVariant RequestManager::requestVideoList(QTcpSocket *caller, QVariant params)
{
QStringList videos;
int max_return = -1;
if(!params.isNull())
{
// Get the packed max_return value
QJsonObject max_return_obj(params.toJsonObject());
QJsonValue max_ret_val( max_return_obj["max_return"]);
QVariant max_ret_var(max_ret_val.toVariant());
if(max_ret_var.type() == QVariant::Int)
max_return = max_ret_var.toInt();
}
videos = VideoLocator::findVideos(mVideoDirectory);
if(max_return != -1)
{
int amount_to_remove = videos.length()-max_return;
//only return the amount passed in
for(int i = 0; i < amount_to_remove; ++i)
{
videos.pop_back();
}
}
QJsonObject ret_object;
ret_object["VideoList"] = QJsonValue::fromVariant(QVariant::fromValue(videos));
QVariant ret_var(QVariant::fromValue(ret_object));
//qDebug() << "Sending back" << ret_var;
return ret_var;
}
示例9: uninstallPackage
bool PackageJobThread::uninstallPackage(const QString &packagePath)
{
if (!QFile::exists(packagePath)) {
d->errorMessage = i18n("%1 does not exist", packagePath);
d->errorCode = Package::JobError::PackageFileNotFoundError;
return false;
}
QString pkg;
QString root;
{
// FIXME: remove, pass in packageroot, type and pluginName separately?
QStringList ps = packagePath.split('/');
int ix = ps.count() - 1;
if (packagePath.endsWith('/')) {
ix = ps.count() - 2;
}
pkg = ps[ix];
ps.pop_back();
root = ps.join('/');
}
bool ok = removeFolder(packagePath);
if (!ok) {
d->errorMessage = i18n("Could not delete package from: %1", packagePath);
d->errorCode = Package::JobError::PackageUninstallError;
return false;
}
indexDirectory(root, QStringLiteral("kpluginindex.json"));
return true;
}
示例10: userSort
QStringList UserManagement::userSort()
{
//sorts the usernames by timestamp
int totalSize=userPlayer.size();
QStringList sortedTimes=userTimestamp;
if(userPlayer.size()>0)
{
sortedTimes.sort();
QStringList sortedNames;
for(int n=totalSize;n>0;n--)
{
for(int i=0;i<userPlayer.size();i++)
{
if(sortedTimes[n-1]==userTimestamp[i])
if(userPlayer[i]!="NULL")
{
sortedNames.append(userPlayer[i]);
}
else
break;
}
}
while(sortedNames.size()>5)//only takes the top 5 for the combobox
{
sortedNames.pop_back();
}
return sortedNames;
}
}
示例11: recent_items_it
void
pcl::modeler::MainWindow::updateRecentActions(std::vector<boost::shared_ptr<QAction> >& recent_actions, QStringList& recent_items)
{
QMutableStringListIterator recent_items_it(recent_items);
while (recent_items_it.hasNext())
{
if (!QFile::exists(recent_items_it.next()))
recent_items_it.remove();
}
recent_items.removeDuplicates();
int recent_number = std::min((int)MAX_RECENT_NUMBER, recent_items.size());
for (int i = 0; i < recent_number; ++ i)
{
QString text = tr("%1 %2").arg(i+1).arg(recent_items[i]);
recent_actions[i]->setText(text);
recent_actions[i]->setData(recent_items[i]);
recent_actions[i]->setVisible(true);
}
for (size_t i = recent_number, i_end = recent_actions.size(); i < i_end; ++ i)
{
recent_actions[i]->setVisible(false);
}
while (recent_items.size() > recent_number) {
recent_items.pop_back();
}
return;
}
示例12: BoardChannel
QMap<int, shared_ptr<BoardChannel> >
ConnectorOld::parseBoardChannels(QString recvMessage)
{
QMap<int, shared_ptr<BoardChannel> > channels;
// Thanks Assaron
//
// CHANNEL_PROPERTIES = (("id", int_decoder),
// ("name", unicode_decoder),
// ("description", unicode_decoder))
QStringList channelsList = recvMessage.split('\r');
channelsList.pop_back(); // Remove empty string
QStringList::const_iterator it;
for (it = channelsList.constBegin(); it != channelsList.constEnd(); ++it)
{
QStringList channel = (*it).split('\t');
shared_ptr<BoardChannel> ch(
new BoardChannel(
this,
channel.at(0).toInt(),
channel.at(1).mid(1),
channel.at(2)));
channels.insert(ch->id(), ch);
}
return channels;
}
示例13: saveShellHistory
void Shell::saveShellHistory()
{
#ifdef CONFIG_READLINE
// Only save history for interactive sessions
if (_listenOnSocket)
return;
// Construct the path name of the history file
QStringList pathList = QString(mt_history_file).split("/", QString::SkipEmptyParts);
pathList.pop_back();
QString path = pathList.join("/");
// Create history path, if it does not exist
if (!QDir::home().exists(path) && !QDir::home().mkpath(path))
debugerr("Error creating path for saving the history");
// Save the history for the next launch
QString histFile = QDir::home().absoluteFilePath(mt_history_file);
QByteArray ba = histFile.toLocal8Bit();
int ret = write_history(ba.constData());
if (ret)
debugerr("Error #" << ret << " occured when trying to save the "
"history data to \"" << histFile << "\"");
#endif
}
示例14: recent
void djvFileInfoUtil::recent(
const QString & fileName,
QStringList & list,
int max)
{
const int index = list.indexOf(fileName);
if (-1 == index)
{
// Insert new item at front of list.
list.push_front(fileName);
while (list.count() > max)
{
list.pop_back();
}
}
else
{
// Move existing item to front of list.
list.removeAt(list.indexOf(fileName));
list.push_front(fileName);
}
}
示例15: readFile
bool XmlLookupTable::readFile(QIODevice &file)
{
if (!file.isOpen())
return false;
int depth = 0;
QXmlStreamReader reader(&file);
QStringList path;
m_data.clear();
while (!reader.atEnd() && !reader.hasError()) {
QXmlStreamReader::TokenType token = reader.readNext();
if (token == QXmlStreamReader::StartElement) {
path.push_back(reader.name().toString());
Entry& entry = m_data[path.join("/")];
QXmlStreamAttributes attributes = reader.attributes();
entry.attributes.clear();
foreach (QXmlStreamAttribute attr, attributes)
entry.attributes[attr.name().toString()]
= attr.value().toString();
++depth;
} else if (token == QXmlStreamReader::Characters) {
Entry& entry = m_data[path.join("/")];
entry.data += reader.text().toString().trimmed();
} else if (token == QXmlStreamReader::EndElement) {
if (depth <= 0)
return false; // malformed xml
--depth;
path.pop_back();
}
}
return !reader.hasError();
}