当前位置: 首页>>代码示例>>C++>>正文


C++ QStringList::takeAt方法代码示例

本文整理汇总了C++中QStringList::takeAt方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::takeAt方法的具体用法?C++ QStringList::takeAt怎么用?C++ QStringList::takeAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStringList的用法示例。


在下文中一共展示了QStringList::takeAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove

DvcsJob::JobStatus GitRunner::remove(const KUrl::List &files)
{
    if (files.empty())
        return m_jobStatus = DvcsJob::JobCancelled;

    DvcsJob *job = new DvcsJob();
    initJob(*job);
    *job << "rm";
    QStringList stringFiles = files.toStringList();
    while (!stringFiles.isEmpty()) {
        *job <<  m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0);
    }

    startJob(*job);
    return m_jobStatus;
}
开发者ID:netrunner-debian-kde-extras,项目名称:plasmate,代码行数:16,代码来源:gitrunner.cpp

示例2: moveDownProfile

bool QGenieWiFiProfileManagerController::moveDownProfile(int index)
{
    bool bret = false;

    if((index >= 0) && (index < (m_profileList.count() - 1)))
    {
        QStringList tmpList = m_profileList;
        tmpList.insert(index,tmpList.takeAt(index + 1));
        bret =  diagnose_inf->SetWlanProfileList(m_curInterface,tmpList);
        if(bret)
        {
            m_profileList.insert(index,m_profileList.takeAt(index + 1));
        }
    }

    return bret;
}
开发者ID:daddyreb,项目名称:Bigit_Genie,代码行数:17,代码来源:QGenieWiFiProfileManagerController.cpp

示例3: add

void GitRunner::add(const KUrl::List &localLocations)
{
    if (localLocations.empty()) {
        return;
    }

    QStringList command;
    command << "add";

    // Adding files to the runner.
    QStringList stringFiles = localLocations.toStringList();
    while (!stringFiles.isEmpty()) {
        command.append(m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0));
    }

    execSynchronously(command);
}
开发者ID:deiv,项目名称:plasmate-pkg,代码行数:17,代码来源:gitrunner.cpp

示例4: add

DvcsJob::JobStatus GitRunner::add(const KUrl::List &localLocations)
{
    if (localLocations.empty())
        return m_jobStatus = DvcsJob::JobCancelled;

    DvcsJob *job = new DvcsJob();
    initJob(*job);
    *job << "add";

    // Adding files to the runner.
    QStringList stringFiles = localLocations.toStringList();
    while (!stringFiles.isEmpty()) {
        *job <<  m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0);
    }

    startJob(*job);
    return m_jobStatus;
}
开发者ID:netrunner-debian-kde-extras,项目名称:plasmate,代码行数:18,代码来源:gitrunner.cpp

示例5: getNode

Node* LoadNodeFactory::getNode( const QString &tagContent, Parser *p ) const
{
  QStringList expr = tagContent.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );

  if ( expr.size() <= 1 ) {
    throw Grantlee::Exception( TagSyntaxError, QString::fromLatin1( "%1 expects at least one argument" ).arg( expr.first() ) );
  }

  expr.takeAt( 0 );

  QListIterator<QString> i( expr );
  while ( i.hasNext() ) {
    QString libName = i.next();
    p->loadLib( libName );
  }

  return new LoadNode( p );
}
开发者ID:hicknhack-software,项目名称:Qt-Grantlee,代码行数:18,代码来源:load.cpp

示例6: remove

void GitRunner::remove(const KUrl::List &files)
{
    if (files.empty()) {
        return;
    }

    QStringList command;
    command << "rm ";
    QStringList stringFiles = files.toStringList();
    while (!stringFiles.isEmpty()) {
        command.append(m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0));
    }

    KJob *job = initJob(command);
    connect(job, SIGNAL(result(KJob*)), this, SLOT(handleRemove(KJob*)));

    job->start();
}
开发者ID:deiv,项目名称:plasmate-pkg,代码行数:18,代码来源:gitrunner.cpp

示例7: run

void ExtCommandsHandler::run()
{
    while (1) {
        QStringList args;
        if (!readRequest(&args)) {
            qWarning ("failed to read request from shell extension: %s",
                      formatErrorMessage().c_str());
            break;
        }

        QString cmd = args.takeAt(0);
        QString resp;
        if (cmd == "list-repos") {
            resp = handleListRepos(args);
        } else if (cmd == "get-share-link") {
            handleGenShareLink(args, false);
        } else if (cmd == "get-internal-link") {
            handleGenShareLink(args, true);
        } else if (cmd == "get-file-status") {
            resp = handleGetFileStatus(args);
        } else if (cmd == "lock-file") {
            handleLockFile(args, true);
        } else if (cmd == "unlock-file") {
            handleLockFile(args, false);
        } else if (cmd == "private-share-to-group") {
            handlePrivateShare(args, true);
        } else if (cmd == "private-share-to-user") {
            handlePrivateShare(args, false);
        } else {
            qWarning ("[ext] unknown request command: %s", cmd.toUtf8().data());
        }

        if (!sendResponse(resp)) {
            qWarning ("failed to write response to shell extension: %s",
                      formatErrorMessage().c_str());
            break;
        }
    }

    qDebug ("An extension client is disconnected: GLE=%lu\n",
            GetLastError());
    DisconnectNamedPipe(pipe_);
    CloseHandle(pipe_);
}
开发者ID:DevCybran,项目名称:seafile-client,代码行数:44,代码来源:ext-handler.cpp

示例8: getNode

Node* IfChangedNodeFactory::getNode( const QString &tagContent, Parser *p ) const
{
    QStringList expr = tagContent.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );

    expr.takeAt( 0 );
    IfChangedNode *n =  new IfChangedNode( getFilterExpressionList( expr, p ), p );

    NodeList trueList = p->parse( n, QStringList() << QLatin1String( "else" ) << QLatin1String( "endifchanged" ) );
    n->setTrueList( trueList );
    NodeList falseList;

    if ( p->takeNextToken().content.trimmed() == QLatin1String( "else" ) ) {
        falseList = p->parse( n, QLatin1String( "endifchanged" ) );
        n->setFalseList( falseList );
        p->removeNextToken();
    }

    return n;
}
开发者ID:saeschdivara,项目名称:Qt-Grantlee,代码行数:19,代码来源:ifchanged.cpp

示例9: getNode

Grantlee::Node* RangeNodeFactory::getNode( const QString& tagContent, Parser* p ) const
{
  QStringList expr = smartSplit( tagContent );

  expr.takeAt( 0 );
  int numArgs = expr.size();
  if ( numArgs != 1 ) {
    if ( numArgs <= 2 ) {
      throw Grantlee::Exception( TagSyntaxError, QStringLiteral( "'range' tag requires at least three arguments" ) );
    }

    if ( expr.at( numArgs - 2 ) != QStringLiteral( "as" ) ) {
      throw Grantlee::Exception( TagSyntaxError, QStringLiteral( "Invalid arguments to 'range' tag" ) );
    }
  }

  const QString name = ( numArgs > 2 ) ? expr.at( numArgs - 1 ) : QString();
  if ( numArgs > 2 )
    numArgs -= 2;

  RangeNode *n = 0;

  switch ( numArgs ) {
  case 1:
    n = new RangeNode( name, FilterExpression( QChar::fromLatin1( '0' ), p ), FilterExpression( expr.first(), p ), p );
    break;
  case 2:
    n = new RangeNode( name, FilterExpression( expr.first(), p ), FilterExpression( expr.at( 1 ), p ), p );
    break;
  case 3:
    n = new RangeNode( name, FilterExpression( expr.first(), p ), FilterExpression( expr.at( 1 ), p ), FilterExpression( expr.at( 2 ), p ), p );
    break;
  default:
    return 0;
  }

  NodeList list = p->parse( n, QStringLiteral( "endrange" ) );
  p->removeNextToken();

  n->setNodeList( list );
  return n;
}
开发者ID:heirecka,项目名称:grantlee,代码行数:42,代码来源:range.cpp

示例10: FindRandomImage

void MythUIImage::FindRandomImage(void)
{
    QDir imageDir(m_imageDirectory);

    if (!imageDir.exists())
    {
        QString themeDir = GetMythUI()->GetThemeDir() + '/';
        imageDir = themeDir + m_imageDirectory;
    }

    QStringList imageTypes;

    QList< QByteArray > exts = QImageReader::supportedImageFormats();
    QList< QByteArray >::Iterator it = exts.begin();

    for (; it != exts.end(); ++it)
    {
        imageTypes.append(QString("*.").append(*it));
    }

    imageDir.setNameFilters(imageTypes);

    QStringList imageList = imageDir.entryList();
    QString randFile;

    if (imageList.size())
    {
        // try to find a different image
        do
        {
            randFile = QString("%1%2").arg(m_imageDirectory)
                                      .arg(imageList.takeAt(random() % imageList.size()));

        } while (imageList.size() > 1 && randFile == m_OrigFilename);
    }

    m_OrigFilename = m_imageProperties.filename = randFile;
}
开发者ID:tgm4883,项目名称:lr-rpi2,代码行数:38,代码来源:mythuiimage.cpp

示例11: loadSession

void TermWidgetHolder::loadSession()
{
    bool ok;
    QString name = QInputDialog::getItem(this, tr("Load Session"),
                                         tr("List of saved sessions:"),
                                         Properties::Instance()->sessions.keys(),
                                         0, false, &ok);
    if (!ok || name.isEmpty())
        return;
#if 0
    foreach (QWidget * w, findChildren<QWidget*>())
    {
        if (w)
        {
            delete w;
            w = 0;
        }
    }

    qDebug() << "load" << name << QString(Properties::Instance()->sessions[name]);
    QStringList splitters = QString(Properties::Instance()->sessions[name]).split("|", QString::SkipEmptyParts);
    foreach (QString splitter, splitters)
    {
        QStringList components = splitter.split(",");
        qDebug() << "comp" << components;
        // orientation
        Qt::Orientation orientation;
        if (components.size() > 0)
            orientation = components.takeAt(0).toInt();
        // sizes
        QList<int> sizes;
        QList<TermWidget*> widgets;
        foreach (QString s, components)
        {
            sizes << s.toInt();
            widgets << newTerm();
        }
开发者ID:raininja,项目名称:qterminal,代码行数:37,代码来源:termwidgetholder.cpp

示例12: parseData

void SourceEntryPrivate::parseData(const QString &data)
{
    if (data.isEmpty())
        return;

    QString tData = data.simplified();

    // Check for nonvalid input
    if (tData.isEmpty() || tData == QChar('#')) {
        isValid = false;
        return;
    }

    QStringList types;
    types << QLatin1String("rpm") << QLatin1String("rpm-src")
          << QLatin1String("deb") << QLatin1String("deb-src");

    // Check source enable state
    if (tData.at(0) == '#') {
        isEnabled = false;
    }
    // Handle multiple comment characters (hey, it happens!)
    while (tData.at(0) == '#') {
        // Remove starting '#' from tData
        tData = tData.remove(0, 1);
        tData = tData.trimmed();
    }

    // Find any #'s past the start (these are comments)
    int idx = tData.indexOf('#');
    if (idx > 0) {
        // Save the comment, then remove from tData
        comment = tData.right(tData.size() - idx - 1);
        tData.remove(idx, tData.size() - idx + 1);
    }

    QStringList pieces = tData.split(' ');
    if (pieces.size() < 3) {
        // Invalid source entry
        isValid = false;
        return;
    }

    // Parse type
    type = pieces.at(0);
    if (!types.contains(type)) {
        isValid = false;
        return;
    }

    // Parse architecture
    if (pieces.at(1).trimmed().at(0) == '[') {
        QStringList options = pieces.takeAt(1).remove('[').remove(']').split(';');
        for (const QString &option : options) {
            QStringList parts = option.split('=');

            if (parts.size() != 2) {
                isValid = false;
                return;
            }

            QString key = parts.at(0);
            QString value = parts.at(1);

            if (key != QLatin1String("arch")) {
                isValid = false;
                return;
            }

            architectures = value.split(',');
        }
    }

    // Parse URI
    uri = pieces.at(1);
    if (uri.isEmpty()) {
        isValid = false;
        return;
    }

    // Parse distro and (optionally) components
    dist = pieces.at(2);
    if (pieces.size() > 3) {
        components = pieces.mid(3);
    }
}
开发者ID:manchicken,项目名称:libqapt,代码行数:86,代码来源:sourceentry.cpp

示例13: main

int main (int argc, char *argv[]) {
	QApplication app (argc, argv);
	QStringList args = app.arguments ();
	if (!args.isEmpty ()) args.pop_front ();	// The command itself
	qputenv ("DESKTOP_STARTUP_ID", qgetenv ("STARTUP_ID_COPY"));	// for startup notifications (set via rkward.desktop)
	qputenv ("STARTUP_ID_COPY", "");

	// Parse arguments that need handling in the wrapper
	bool usage = false;
	QStringList debugger_args;
	QStringList file_args;
	bool reuse = false;
	bool warn_external = true;
	QString r_exe_arg;
	int debug_level = 2;

	for (int i=0; i < args.size (); ++i) {
		if (args[i] == "--debugger") {
			args.removeAt (i);
			while (i < args.size ()) {
				QString arg = args.takeAt (i);
				if (arg == "--") break;
				debugger_args.append (arg);
			}
			if (debugger_args.isEmpty ()) usage = true;
		} else if (args[i] == "--r-executable") {
			if ((i+1) < args.size ()) {
				r_exe_arg = args.takeAt (i + 1);
			} else usage = true;
			args.removeAt (i);
			--i;
		} else if (args[i] == "--debug-level") {
			if ((i+1) < args.size ()) {
				debug_level = args[i+1].toInt ();
			}
		} else if (args[i] == "--reuse") {
			reuse = true;
		} else if (args[i] == "--nowarn-external") {
			warn_external = false;
		} else if (args[i].startsWith ("--")) {
			// all RKWard and KDE options (other than --reuse) are of the for --option <value>. So skip over the <value>
			i++;
		} else {
			QUrl url (args[i]);
			if (url.isRelative ()) {
				file_args.append (QDir::current ().absoluteFilePath (url.toLocalFile ()));
			} else {
				file_args.append (args[i]);
			}
		}
	}

	if (reuse) {
		if (!QDBusConnection::sessionBus ().isConnected ()) {
			if (debug_level > 2) qDebug ("Could not connect to session dbus");
		} else {
			QDBusInterface iface (RKDBUS_SERVICENAME, "/", "", QDBusConnection::sessionBus ());
			if (iface.isValid ()) {
				QDBusReply<void> reply = iface.call ("openAnyUrl", file_args, warn_external);
				if (!reply.isValid ()) {
					if (debug_level > 2) qDebug ("Error while placing dbus call: %s", qPrintable (reply.error ().message ()));
					return 1;
				}
				return 0;
			}
		}
	}

	// MacOS may need some path adjustments, first
#ifdef Q_WS_MAC
	QString oldpath = qgetenv ("PATH");
	if (!oldpath.contains (INSTALL_PATH)) {
		//ensure that PATH is set to include what we deliver with the bundle
		qputenv ("PATH", QString ("%1/bin:%1/sbin:%2").arg (INSTALL_PATH).arg (oldpath).toLocal8Bit ());
		if (debug_level > 3) qDebug ("Adjusting system path to %s", qPrintable (qgetenv ("PATH")));
	}
	// ensure that RKWard finds its own packages
	qputenv ("R_LIBS", R_LIBS);
	QProcess::execute ("launchctl", QStringList () << "load" << "-w" << INSTALL_PATH "/Library/LaunchAgents/org.freedesktop.dbus-session.plist");
#endif

	// Locate KDE and RKWard installations
	QString kde4_config_exe = findExeAtPath ("kde4-config", QDir::currentPath ());
	if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", app.applicationDirPath ());
	if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", QDir (app.applicationDirPath ()).filePath ("KDE/bin"));
	if (kde4_config_exe.isNull ()) {
#ifdef Q_WS_WIN
	QStringList syspath = QString (qgetenv ("PATH")).split (';');
#else
	QStringList syspath = QString (qgetenv ("PATH")).split (':');
#endif
		for (int i = 0; i < syspath.size (); ++i) {
			kde4_config_exe = findExeAtPath ("kde4-config", syspath[i]);
			if (!kde4_config_exe.isNull ()) break;
		}
	}

	if (kde4_config_exe.isNull ()) {
		QMessageBox::critical (0, "Could not find KDE installation", "The KDE installation could not be found (kde4-config). When moving / copying RKWard, make sure to copy the whole application folder, or create a shorcut / link, instead.");
		exit (1);
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:rkward,代码行数:101,代码来源:rkward_startup_wrapper.cpp

示例14: execute

/*!
    Executes the command described in \a arguments, in the
    environment inherited from the parent process, with the
    \a additionalEnv settings applied.
    \a removeEnv removes the specified environment variables from
    the environment of the executed process.

    Returns the exit value of the process, or -1 if the command could
    not be executed.

    This function uses _(w)spawnvpe to spawn a process by searching
    through the PATH environment variable.
*/
int Environment::execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv)
{
#ifdef CONFIGURE_DEBUG_EXECUTE
    qDebug() << "About to Execute: " << arguments;
    qDebug() << "   " << QDir::currentPath();
    qDebug() << "   " << additionalEnv;
    qDebug() << "   " << removeEnv;
#endif
    // Create the full environment from the current environment and
    // the additionalEnv strings, then remove all variables defined
    // in removeEnv
    QMap<QString, QString> fullEnvMap;
    LPWSTR envStrings = GetEnvironmentStrings();
    if (envStrings) {
        int strLen = 0;
        for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
            strLen = wcslen(envString);
            QString str = QString((const QChar*)envString, strLen);
            if (!str.startsWith("=")) { // These are added by the system
                int sepIndex = str.indexOf('=');
                fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
            }
        }
    }
    FreeEnvironmentStrings(envStrings);

    // Add additionalEnv variables
    for (int i = 0; i < additionalEnv.count(); ++i) {
        const QString &str = additionalEnv.at(i);
        int sepIndex = str.indexOf('=');
        fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
    }

    // Remove removeEnv variables
    for (int j = 0; j < removeEnv.count(); ++j)
        fullEnvMap.remove(removeEnv.at(j).toUpper());

    // Add all variables to a QStringList
    QStringList fullEnv;
    QMapIterator<QString, QString> it(fullEnvMap);
    while (it.hasNext()) {
        it.next();
        fullEnv += QString(it.key() + "=" + it.value());
    }

    // ----------------------------
    QString program = arguments.takeAt(0);
    QString args = qt_create_commandline(program, arguments);
    QByteArray envlist = qt_create_environment(fullEnv);

    DWORD exitCode = -1;
    PROCESS_INFORMATION procInfo;
    memset(&procInfo, 0, sizeof(procInfo));

    STARTUPINFO startInfo;
    memset(&startInfo, 0, sizeof(startInfo));
    startInfo.cb = sizeof(startInfo);

    bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(),
                                      0, 0, true, CREATE_UNICODE_ENVIRONMENT,
                                      envlist.isEmpty() ? 0 : envlist.data(),
                                      0, &startInfo, &procInfo);

    if (couldExecute) {
        WaitForSingleObject(procInfo.hProcess, INFINITE);
        GetExitCodeProcess(procInfo.hProcess, &exitCode);
        CloseHandle(procInfo.hThread);
        CloseHandle(procInfo.hProcess);
    }


    if (exitCode == -1) {
        switch(GetLastError()) {
        case E2BIG:
            cerr << "execute: Argument list exceeds 1024 bytes" << endl;
            foreach(QString arg, arguments)
                cerr << "   (" << arg.toLocal8Bit().constData() << ")" << endl;
            break;
        case ENOENT:
            cerr << "execute: File or path is not found (" << program.toLocal8Bit().constData() << ")" << endl;
            break;
        case ENOEXEC:
            cerr << "execute: Specified file is not executable or has invalid executable-file format (" << program.toLocal8Bit().constData() << ")" << endl;
            break;
        case ENOMEM:
            cerr << "execute: Not enough memory is available to execute new process." << endl;
            break;
//.........这里部分代码省略.........
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:101,代码来源:environment.cpp

示例15: setModelIndexes

void PropertyEditorModel::setModelIndexes(const QModelIndex &logicalModelIndex
		, const QModelIndex &graphicalModelIndex)
{
	beginResetModel();
	mField.reset(new Field());
	endResetModel();

	mTargetLogicalObject = logicalModelIndex;
	mTargetGraphicalObject = graphicalModelIndex;

	if (!isValid()) {
		return;
	}

	const Id logicalId = mTargetLogicalObject.data(roles::idRole).value<Id>();
	const QString dynamicProperties = dynamic_cast<models::details::LogicalModel *>(mTargetLogicalModel)->
			logicalModelAssistApi().logicalRepoApi().stringProperty(logicalId, "dynamicProperties");

	if (logicalModelIndex != QModelIndex()) {
		const QStringList logicalProperties = mEditorManagerInterface.propertyNames(logicalId.type());

		int role = roles::customPropertiesBeginRole;
		QStringList cloneWithRoles;
		QStringList cloneWithPure;

		for (const QString &prop : logicalProperties) {
			if (prop.contains("!")) {
				cloneWithRoles.append(prop);
			} else {
				cloneWithPure.append(prop);
			}
		}

		int i = 0;
		role = roles::customPropertiesBeginRole;
		while (cloneWithRoles.size() > 0) {
			const QString roleName = cloneWithRoles.takeAt(0);
			const int first = roleName.indexOf("!");
			const QString beginPartName = roleName.mid(0, first);
			mField->appendChild(new Field(beginPartName));
			auto parent = mField->child(i);

			QString endPartName = roleName.mid(first + 1);
			mField->appendChild(
					new Field(
							endPartName
							, logicalAttribute
							, role
							, parent
							, mTargetLogicalObject
							, mTargetGraphicalObject)
						);
			++i;
			++role;

			int j = 0;
			while (j < cloneWithRoles.size()) {
				if (cloneWithRoles.at(j).mid(0, first) == beginPartName) {
					QString roleName = cloneWithRoles.takeAt(j);
					roleName = roleName.mid(first + 1);
					mField->appendChild(
							new Field(
									roleName
									, logicalAttribute
									, role
									, parent
									, mTargetLogicalObject
									, mTargetGraphicalObject)
								);
					++i;
					++role;
					j = 0;
				} else {
					++j;
				}
			}

			++i;
		}

		while (cloneWithPure.size()  > 0) {
			QString roleName = cloneWithPure.takeAt(0);
			mField->appendChild(
					new Field(
							roleName
							, logicalAttribute
							, role
							, nullptr
							, mTargetLogicalObject
							, mTargetGraphicalObject)
						);
			++i;
			++role;
		}

		if (!dynamicProperties.isEmpty()) {
			QDomDocument dynamProperties;
			dynamProperties.setContent(dynamicProperties);
			for (QDomElement element = dynamProperties.firstChildElement("properties").firstChildElement("property")
					; !element.isNull()
//.........这里部分代码省略.........
开发者ID:ZiminGrigory,项目名称:qreal,代码行数:101,代码来源:propertyEditorModel.cpp


注:本文中的QStringList::takeAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。