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


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

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


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

示例1: buttonPressed

void FileNameEditorWidget::buttonPressed() {
  QFileDialog *dlg = new QFileDialog(this, "Choose a file", basePath, fileFilter);
  dlg->setModal(true);
  dlg->setFileMode(QFileDialog::ExistingFile);

  if (dlg->exec() == QDialog::Accepted) {
    QString file = dlg->selectedFiles().first();

    if (!file.isNull()) {
      QStringList currentDir = QDir::currentPath().split(QDir::separator());
      QStringList filePath = QFileInfo(file).dir().absolutePath().split(QDir::separator());
      QString relativePath = "";

      while ((!currentDir.empty() && !filePath.empty()) && (currentDir.front()
             == filePath.front())) {
        currentDir.pop_front();
        filePath.pop_front();
      }

      while (!currentDir.empty()) {
        relativePath += "..";
        relativePath += QDir::separator();
        currentDir.pop_front();
      }

      if (!filePath.empty())
        relativePath += filePath.join((const QString) (QChar) QDir::separator())
                        + QDir::separator();

      setFileName(relativePath + QFileInfo(file).fileName());
    }
  }

  delete dlg;
}
开发者ID:kdbanman,项目名称:browseRDF,代码行数:35,代码来源:FileNameEditorWidget.cpp

示例2: 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();
}
开发者ID:eduffy,项目名称:hpcvmmon,代码行数:25,代码来源:AddSessionDialog.cpp

示例3: getWidget

void Vizkit3DConfig::setCameraManipulator(QStringList const& manipulator)
{
    if (getWidget()->getCameraManipulatorName() == manipulator.front())
        return;
    
    CAMERA_MANIPULATORS id = manipulatorNameToID(manipulator.front());
    return getWidget()->setCameraManipulator(id);
}
开发者ID:arneboe,项目名称:gui-vizkit3d,代码行数:8,代码来源:Vizkit3DWidget.cpp

示例4: 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.";
      }
    }
开发者ID:Eric89GXL,项目名称:CTK,代码行数:55,代码来源:ctkPluginFrameworkContext.cpp

示例5: processCompletion

DCDCompletion QcdAssist::processCompletion(QByteArray dataArray)
{
	DCDCompletion completion;

	QString data = QString::fromUtf8(dataArray.data(),dataArray.length());
	QStringList lines = data.split(QRegExp(QLatin1String("[\r\n]")), QString::SkipEmptyParts);
	if(lines.length() == 0)
		return completion;

	QString type = lines.front();
	if(type.startsWith(QLatin1String("WARNING:")))
	{
		lines.pop_front();
		if(lines.length() == 0)
			return completion;
		type = lines.front();
	}
	if(type == QLatin1String("identifiers"))
		completion.type = Identifiers;
	else if(type == QLatin1String("calltips"))
		completion.type = Calltips;
	else
	{
		//Core::MessageManager::write(QString(QLatin1String("qcdassist error: Invalid typ=:")).arg(type));
		return completion;
	}
	lines.pop_front();

	foreach(QString line, lines)
	{
		if(line.trimmed().length() == 0)
			continue;

		QStringList kv = line.split(QRegExp(QLatin1String("\\s+")), QString::SkipEmptyParts);
		if(kv.length() != 2 && completion.type != Calltips)
		{
			//Core::MessageManager::write(QString(QLatin1String("qcdassist error: invalid completion data:")).arg(kv.length()).arg(completion.type));
			continue;
		}

		if(completion.type == Identifiers)
		{
			completion.completions.append(DCDCompletionItem(
				(DCDCompletionItemType)kv[1].at(0).toLatin1(), kv[0]));
		}
		else
		{
			completion.completions.append(DCDCompletionItem(Calltip, line));
		}
	}

	return completion;
}
开发者ID:FrankLIKE,项目名称:QtCreatorD,代码行数:53,代码来源:qcdassist.cpp

示例6:

static QString argv0BaseName()
{
    QString result;
    const QStringList arguments = QCoreApplication::arguments();
    if (!arguments.isEmpty() && !arguments.front().isEmpty()) {
        result = arguments.front();
        const int lastSlashPos = result.lastIndexOf(QLatin1Char('/'));
        if (lastSlashPos != -1)
            result.remove(0, lastSlashPos + 1);
    }
    return result;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:12,代码来源:qxcbintegration.cpp

示例7: while

void AnnotationJobs::GetAnnotationJob::slotInfoMessage(KIO::Job *, const QString &str)
{
    // Parse the result
    QStringList lst = QStringList::split("\r", str);
    while(lst.count() >= 2)    // we take items 2 by 2
    {
        QString name = lst.front();
        lst.pop_front();
        QString value = lst.front();
        lst.pop_front();
        mAnnotations.append(AnnotationAttribute(mEntry, name, value));
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:13,代码来源:annotationjobs.cpp

示例8: open

void MainWindow::open(QString fileName = QString("")) {
  QStringList fileNames;
  
  if (fileName.isEmpty()) {
    fileNames = QFileDialog::getOpenFileNames(this, "Select one or more files to open", (openFiles.size() > 0 && !getCurFileObj()->path.isEmpty()) ? getCurFileObj()->path : lastDir);
  } else {
    fileNames.push_front(fileName);
  }

  
  while (fileNames.count()) {
    if (!fileNames.back().isEmpty()) {
      bool alreadyOpen = false;
      QList<QsciteEditor *> openTabs = openFiles.keys();
      QList<QsciteEditor *>::iterator tab;
      for (tab = openTabs.begin(); tab != openTabs.end(); ++tab) {
        if (fileNames.front() == openFiles[*tab].fullName) {
          alreadyOpen = true;

          if (fileNames.count() == 1) {
            changeTabs(*tab);
          }

          qDebug() << "file is already open";
        }
      }
      
      if (alreadyOpen) {
        fileNames.pop_front();
        continue;
      }
      
      if ((!tabWidget->count()) || (!getCurFileObj()->baseName.isEmpty()) || getCurDoc()->isModified()) {
        createDocument();
      }

      loadFile(fileNames.front());
      setCurrentTabTitle();

      addRecentFile(fileNames.front());
    }

    fileNames.pop_front();
  }

  if (!openFiles.empty()) {
    getCurDoc()->setFocus();
    lastDir = getCurFileObj()->path;
  }
}
开发者ID:spthaolt,项目名称:qscite,代码行数:50,代码来源:mainwindow_uislots.cpp

示例9: 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()));
    }
开发者ID:JianpingCAI,项目名称:starlab,代码行数:34,代码来源:gui_filter.cpp

示例10: saveNewWorkspace

void MainWindow::saveNewWorkspace()
{
    QDomDocument* config = generateWorkspaceXML();
    QStringList fileNames; //stores the entire path of the file that it attempts to open

    QStringList filters; //setting file filters
    filters << "ReViz configuration files (*.revizconfig)"
            << "Any files (*)";

    //initializing the File dialog box
    //the static QFileDialog does not seem to be working correctly in Ubuntu 12.04 with unity.
    //as per the documentation it may work correctly with gnome
    //the method used below should work correctly on all desktops and is supposedly more powerful
    QFileDialog dialog(this);
    dialog.setNameFilters(filters);
    dialog.setAcceptMode(QFileDialog::AcceptSave);
    dialog.setFileMode(QFileDialog::AnyFile);
    if (dialog.exec())
        fileNames = dialog.selectedFiles();

    if (!fileNames.isEmpty())
        saveConfigFile(config, &fileNames.front());
    else
        std::cerr << "No file was selected" << std::endl;
}
开发者ID:petevieira,项目名称:reviz-g,代码行数:25,代码来源:MainWindow.cpp

示例11: setClients

void ServerObject::setClients(QStringList addys)
{
	QStringList connected_list;
	if (!threadlist.isEmpty())
	{
		threadlist.at(0);
		do
		{
			threadlist.current()->setHost(threadlist.current()->getHost());
			connected_list.push_back(threadlist.current()->getHost());
		}
		while(threadlist.next());
	}
	QString temp;
	QString hostname;
	int socket;
	if (!addys.isEmpty()) {
		while ((!addys.isEmpty())&&(threadlist.count() < 400)){
			temp=addys.front();
			addys.pop_front();
			socket = temp.section(":", 1, 1).toInt();
			hostname = temp.section(":", 0, 0);
			hostname.append(suffix);
			if (clientlist.grep(temp).isEmpty() || connected_list.grep(temp).isEmpty())
			{
				threadlist.append(new Thread(this, socket));
				threadlist.current()->setHost(hostname);
				if (clientlist.grep(temp).isEmpty()) clientlist.push_back(temp);
			}
		} 
	}
}
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:32,代码来源:serverobject.cpp

示例12: Handle

Handle(Standard_Type) Subassembly::lookupType ( QStringList& path_components ) const
{
  // The front path component is the name of a figure with ".type" appended
  // to it.
  int dot_pos = path_components.front().lastIndexOf( '.' );
  QString name = path_components.front().left( dot_pos );
  QString type = path_components.front().right( path_components.front().length()
						- dot_pos - 1 );

  if ( subassembly_->name() == name && subassembly_->type() == type ) {
    path_components.erase( path_components.begin() );
    return subassembly_->lookupType( path_components );
  }

  return Handle(Standard_Type)();
}
开发者ID:mcirsta,项目名称:lignumCAD,代码行数:16,代码来源:subassembly.cpp

示例13: 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;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例14: 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();
    }
}
开发者ID:rue-ryuzaki,项目名称:QtXlsxWriter,代码行数:28,代码来源:xlsxcellrange.cpp

示例15: QWidget

Kleo::CryptoConfigComponentGUI::CryptoConfigComponentGUI(
  CryptoConfigModule* module, Kleo::CryptoConfigComponent* component,
  QWidget* parent )
  : QWidget( parent ),
    mComponent( component )
{
  QGridLayout * glay = new QGridLayout( this );
  glay->setSpacing( KDialog::spacingHint() );
  const QStringList groups = mComponent->groupList();
  if ( groups.size() > 1 ) {
    glay->setColumnMinimumWidth( 0, KDHorizontalLine::indentHint() );
    for ( QStringList::const_iterator it = groups.begin(), end = groups.end() ; it != end; ++it ) {
      Kleo::CryptoConfigGroup* group = mComponent->group( *it );
      Q_ASSERT( group );
      if ( !group )
        continue;
      const QString title = group->description();
      KDHorizontalLine * hl = new KDHorizontalLine( title.isEmpty() ? *it : title, this );
      const int row = glay->rowCount();
      glay->addWidget( hl, row, 0, 1, 3 );
      mGroupGUIs.append( new CryptoConfigGroupGUI( module, group, glay, this ) );
    }
  } else if ( !groups.empty() ) {
    mGroupGUIs.append( new CryptoConfigGroupGUI( module, mComponent->group( groups.front() ), glay, this ) );
  }
  glay->setRowStretch( glay->rowCount(), 1 );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:27,代码来源:cryptoconfigmodule.cpp


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