本文整理汇总了C++中QStringList::last方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::last方法的具体用法?C++ QStringList::last怎么用?C++ QStringList::last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::last方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMouse
//====================================
// setMouse
//------------------------------------
void SaXManipulateMice::setMouse ( const QString& group ) {
// .../
//! set all mouse data associated with the given group name to
//! the current pointer data. The group name consists of the
//! vendor and model name separated by a colon
// ----
if ( ! mCDBMice ) {
mCDBMice = new SaXProcess ();
mCDBMice -> start (CDB_POINTERS);
}
QList< QDict<QString> > data;
data = mCDBMice -> getTablePointerCDB_DATA (
group
);
// .../
// move the data record to the correct position
// refering to the section ID -> mPointer
// ----
QDict<QString>* record = data.take(0);
for (int n=0;n < mPointer;n++) {
data.append(new QDict<QString>());
}
data.append ( record );
// .../
// merge the data into the current section now
// ----
if (data.isEmpty()) {
excCDBRecordNotFound (group);
qError (errorString(),EXC_CDBRECORDNOTFOUND);
return;
}
mImport -> merge ( data );
// .../
// set vendor and name tag
// ----
QStringList nameList = QStringList::split ( ":", group );
mImport -> setItem ( "Vendor", nameList.first() );
mImport -> setItem ( "Name" , nameList.last() );
}
示例2: xsputn
std::streamsize OutputStream::xsputn(char const *s, std::streamsize count)
{
QString str = QString(s).left(count);
if(str.contains("\n"))
{
QStringList strList = str.split("\n");
addLine(m_buffer + strList[0]);
for(int i = 1; i < strList.size() - 1; ++i)
addLine(strList[i]);
scrollToBottom();
m_buffer = strList.last();
}
else
m_buffer += str;
return count;
}
示例3: newDrop
void ZDLIWadList::newDrop(QStringList fileList){
for(int i = 0; i < fileList.size(); i++){
ZDLNameListable *zList = NULL;
QString entry = fileList[i];
QStringList pathParts = entry.split("/");
if(pathParts.size() > 1){
QString file = pathParts.last();
QStringList fileParts = file.split(".");
if(fileParts.size() > 1){
QString name = fileParts[0];
zList = new ZDLNameListable(pList, 1001, entry, name);
}else{
zList = new ZDLNameListable(pList, 1001, entry, file);
}
}else{
zList = new ZDLNameListable(pList, 1001, entry, entry);
}
if(zList){
insert(zList, -1);
}
}
}
示例4: slotUpdateDirectories
void FolderWizardTargetPage::slotUpdateDirectories(QStringList list)
{
QFileIconProvider prov;
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
QString webdavFolder = QUrl(ownCloudInfo::instance()->webdavUrl()).path();
connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(slotItemExpanded(QTreeWidgetItem*)));
QTreeWidgetItem *root = _ui.folderTreeWidget->topLevelItem(0);
if (!root) {
root = new QTreeWidgetItem(_ui.folderTreeWidget);
root->setText(0, tr("Root (\"/\")", "root folder"));
root->setIcon(0, folderIcon);
root->setToolTip(0, tr("Choose this to sync the entire account"));
root->setData(0, Qt::UserRole, "/");
}
foreach (QString path, list) {
path.remove(webdavFolder);
QStringList paths = path.split('/');
if (paths.last().isEmpty()) paths.removeLast();
recursiveInsert(root, paths, path);
}
示例5: postLaunch
/*!
Any actions that can be delayed until the window is visible
*/
void BrowserApplication::postLaunch()
{
QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
if (directory.isEmpty())
directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
QWebSettings::setIconDatabasePath(directory);
QWebSettings::setOfflineStoragePath(directory);
setWindowIcon(QIcon(QLatin1String(":browser.svg")));
loadSettings();
// newMainWindow() needs to be called in main() for this to happen
if (m_mainWindows.count() > 0) {
QStringList args = QCoreApplication::arguments();
if (args.count() > 1)
mainWindow()->loadPage(args.last());
else
mainWindow()->slotHome();
}
BrowserApplication::historyManager();
}
示例6: setIndex
void InfoPanel::setIndex(const QModelIndex& index)
{
if (!index.isValid()) {
updateWithDefaults();
} else {
const Archive::Entry *entry = m_model->entryForIndex(index);
QMimeDatabase db;
QMimeType mimeType;
if (entry->isDir()) {
mimeType = db.mimeTypeForName(QStringLiteral("inode/directory"));
} else {
mimeType = db.mimeTypeForFile(entry->fullPath(), QMimeDatabase::MatchExtension);
}
iconLabel->setPixmap(getDesktopIconForName(mimeType.iconName()));
if (entry->isDir()) {
int dirs;
int files;
const int children = m_model->childCount(index, dirs, files);
additionalInfo->setText(KIO::itemsSummaryString(children, files, dirs, 0, false));
} else if (!entry->property("link").toString().isEmpty()) {
additionalInfo->setText(i18n("Symbolic Link"));
} else {
if (entry->property("size") != 0) {
additionalInfo->setText(KIO::convertSize(entry->property("size").toULongLong()));
} else {
additionalInfo->setText(i18n("Unknown size"));
}
}
const QStringList nameParts = entry->fullPath().split(QLatin1Char( '/' ), QString::SkipEmptyParts);
const QString name = (nameParts.count() > 0) ? nameParts.last() : entry->fullPath();
fileName->setText(name);
showMetaDataFor(index);
}
}
示例7: newMessage
void S2Controller::processMessage(){
// once a fullMessage is made, this method should only be called as a slot
// because it unblocks the ability to send tcp commands
// - parse the message here, extracting the returned message
message = QString("");
QStringList mList;
mList = stringMessage.split("ACK\r\n");
message = QString(mList.last().split("DONE\r\n").first());// still has carriage return
message.remove("\r\n");
// and emitting the message, including updating text fields, etc.
emit newMessage(message);
// clear the fullMessage buffer [this should be OK- only this method
// and checkForMessages should ever access it] note this is not scalable-
// there's only one fullMessage at a time.
stringMessage.clear();
// unblock commands
okToSend = true;
sendCommandButton->setEnabled(true);
}
示例8: s
WebBrowserApp::WebBrowserApp(int argc,char **argv) :
QApplication(argc,argv),
m_pLocalServer(0)
{
QLocalSocket *socket = new QLocalSocket;
QString strAppName = QCoreApplication::applicationName();
socket->connectToServer(strAppName);
if(socket->waitForConnected(500))
{
QTextStream s(socket);
QStringList args = QCoreApplication::arguments();
if(args.count() > 1) {
s << args.last();
}else{
s <<QString();
}
s.flush();
socket->waitForBytesWritten();
return;
}
m_pLocalServer = new QLocalServer(this);
connect(m_pLocalServer,SIGNAL(newConnection()),
this,SLOT(newConnection()));
if(!m_pLocalServer->listen(strAppName)) {
if (m_pLocalServer->serverError() == QAbstractSocket::AddressInUseError
&& QFile::exists(m_pLocalServer->serverName())) {
QFile::remove(m_pLocalServer->serverName());
m_pLocalServer->listen(strAppName);
}
}
}
示例9: setupUi
void ParametersToolBox::setupUi(const ParametersMap & parameters)
{
parameters_ = parameters;
QWidget * currentItem = 0;
QStringList groups;
for(ParametersMap::const_iterator iter=parameters.begin();
iter!=parameters.end();
++iter)
{
QStringList splitted = QString::fromStdString(iter->first).split('/');
QString group = splitted.first();
QString name = splitted.last();
if(currentItem == 0 || currentItem->objectName().compare(group) != 0)
{
groups.push_back(group);
QScrollArea * area = new QScrollArea(this);
stackedWidget_->addWidget(area);
currentItem = new QWidget();
currentItem->setObjectName(group);
QVBoxLayout * layout = new QVBoxLayout(currentItem);
layout->setSizeConstraint(QLayout::SetMinimumSize);
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(0);
area->setWidget(currentItem);
addParameter(layout, iter->first, iter->second);
}
else
{
addParameter((QVBoxLayout*)currentItem->layout(), iter->first, iter->second);
}
}
comboBox_->addItems(groups);
connect(comboBox_, SIGNAL(currentIndexChanged(int)), stackedWidget_, SLOT(setCurrentIndex(int)));
updateParametersVisibility();
}
示例10: updateTreeView
void MagicalObjectWindow::updateTreeView(QString raceDir)
{
// get list of existing models to verify if some exist
QDir* modelDir = new QDir(MAGICAL_OBJECT_PATH + "/" + raceDir);
QStringList existingObjects;
MagicalObject obj;
objectList.clear();
if (modelDir->exists())
{
existingObjects = modelDir->entryList();
for(int i = 0; i <existingObjects.size(); ++i)
{
QStringList pieces = existingObjects[i].split(".");
if(pieces.last() == "om")
{
obj.load(MAGICAL_OBJECT_PATH + "/" + raceDir + "/" + existingObjects[i]);
objectList.append(obj);
}
}
}
if(existingObjects.isEmpty())
{
QLog_Info(LOG_ID_INFO, "on_comboBoxRace_currentIndexChanged() : No magical object found in race : " + raceDir);
}
objects->clear();
for(int i = 0 ; i < objectList.size() ; i++)
{
QList<QStandardItem *> newObject;
newObject<<new QStandardItem(objectList[i].getName())
<<new QStandardItem(QString::number(objectList[i].getPoints()))
<<new QStandardItem(objectList[i].getSpecialRules());
objects->appendRow(newObject);
}
objects->setHorizontalHeaderLabels(OBJECT_HEADER);
}
示例11: visitTemplateArgument
void NameCompiler::visitTemplateArgument(TemplateArgumentAST *node)
{
if (node->type_id && node->type_id->type_specifier) {
TypeCompiler type_cc(_M_binder);
type_cc.run(node->type_id->type_specifier);
DeclaratorCompiler decl_cc(_M_binder);
decl_cc.run(node->type_id->declarator);
if (type_cc.isConstant())
_M_name.last() += "const ";
QStringList q = type_cc.qualifiedName();
if (q.count() == 1) {
#if defined (RXX_RESOLVE_TYPEDEF) // ### it'll break :(
TypeInfo tp;
tp.setQualifiedName(q);
tp = TypeInfo::resolveType(tp, _M_binder->currentScope()->toItem());
q = tp.qualifiedName();
#endif
if (CodeModelItem item = _M_binder->model()->findItem(q, _M_binder->currentScope()->toItem())) {
if (item->name() == q.last())
q = item->qualifiedName();
}
}
_M_name.last() += q.join("::");
if (decl_cc.isReference())
_M_name.last() += "&";
if (decl_cc.indirection())
_M_name.last() += QString(decl_cc.indirection(), '*');
_M_name.last() += QLatin1String(",");
}
}
示例12: complete
void ChatEdit::complete()
{
QString completionPrefix = textUnderCursor();
if (completionPrefix.isEmpty()) {
if (cc->popup()->isVisible())
cc->popup()->hide();
return;
}
if (!cc->popup()->isVisible() || completionPrefix.length() < cc->completionPrefix().length()) {
QString pattern = QString("(\\[.*\\])?%1.*").arg( QRegExp::escape(completionPrefix) );
QStringList nicks = cc_model->findItems(pattern, Qt::MatchRegExp, 0);
if (nicks.isEmpty())
return;
if (nicks.count() == 1) {
insertToPos(nicks.last(), textCursor().position() - completionPrefix.length());
return;
}
NickCompletionModel *tmpModel = new NickCompletionModel(nicks, cc);
cc->setModel(tmpModel);
}
if (completionPrefix != cc->completionPrefix()) {
cc->setCompletionPrefix(completionPrefix);
cc->popup()->setCurrentIndex(cc->completionModel()->index(0, 0));
}
QRect cr = cursorRect();
cr.setWidth(cc->popup()->sizeHintForColumn(0)
+ cc->popup()->verticalScrollBar()->sizeHint().width());
cc->complete(cr);
}
示例13: assign
void MiniSceneRule::assign(QStringList &generals, QStringList &generals2, QStringList &kingdoms, Room *room) const
{
QStringList generalnames = Sanguosha->getRandomGenerals(999);
for (int i = 0; i < players.length(); i++) {
QMap<QString, QString> sp = players.at(i);
QString name = sp["general"];
QString name2 = sp["general2"];
generalnames.removeOne(name);
generalnames.removeOne(name2);
}
QList<ServerPlayer *> splayers = room->getAllPlayers();
int count = qFloor(generalnames.length() / players.length());
count = qMin(count, 9);
for (int i = 0; i < players.length(); i++) {
QMap<QString, QString> sp = players.at(i);
QString name = sp["general"];
QString name2 = sp["general2"];
if (name == "select" || name2 == "select") {
QStringList choices;
for (int index = 0; index < generalnames.length(); index++) {
if (index >= i * count && index < (i + 1) * count)
choices << generalnames.at(index);
}
if (name == "select") {
QStringList names = room->askForGeneral(splayers.at(i), choices, QString(), name2 != "select").split("+");
name = names.first();
if (name2 == "select")
name2 = names.last();
}
if (name2 == "select")
name2 = room->askForGeneral(splayers.at(i), choices);
}
generals << name;
generals2 << name2;
QString k = sp["nationality"].isEmpty() ? Sanguosha->getGeneral(name)->getKingdom() : sp["nationality"];
kingdoms << k;
}
}
示例14: setOffset
void CallStringOffsetProvider::setOffset(int offset)
{
if (offset == 0)
{
vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(0,0));
return;
}
QStringList components = this->components();
if (offset == components.join("").size())
{
vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(vis_->xEnd(),0));
return;
}
int listOffest = 0;
int listIndex = components[1] == "." ? 3 : 1;
for(int i = 0; i< listIndex; ++i)
listOffest += components[i].size();
if (offset <= listOffest)
{
SequentialVisualizationStringOffsetProvider::setOffset(offset);
return;
}
else offset -= listOffest;
if ( setOffsetInListItem(offset, vis_->arguments(), "(", ",", ")"))
return;
if (offset == components.last().size())
{
vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(vis_->xEnd(),0));
}
else
Q_ASSERT(false);
}
示例15: toQml
QString QmlTextGenerator::toQml(const ModelNode &node, int indentDepth) const
{
QString type = node.type();
QString url;
if (type.contains('.')) {
QStringList nameComponents = type.split('.');
url = nameComponents.first();
type = nameComponents.last();
}
QString alias;
if (!url.isEmpty()) {
foreach (const Import &import, node.model()->imports()) {
if (import.url() == url) {
alias = import.alias();
break;
}
if (import.file() == url) {
alias = import.alias();
break;
}
}
}