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


C++ QList::begin方法代码示例

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


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

示例1: MayaModule

FrmAlbaranProveedor::FrmAlbaranProveedor(QWidget *parent, bool showCerrar) :
    MayaModule(module_zone(),module_name(),parent),
    ui(new Ui::FrmAlbaranProveedor),
    helper(this),
    prov(this),
    menuButton(QIcon(":/Icons/PNG/albaran_pro.png"),tr("Albaranes Prov."),this),
    push(new QPushButton(QIcon(":/Icons/PNG/albaran_pro.png"),"",this))
{
    ui->setupUi(this);
    oAlbPro = new AlbaranProveedor(this);
    push->setStyleSheet("background-color: rgb(133, 170, 142)");
    push->setToolTip(tr("Gestión de albaranes de proveedor"));
    ui->cbo_pais->setModel(Configuracion_global->paises_model);
    //ui->cbo_pais->setModelColumn(Configuracion_global->paises_model->fieldIndex("pais"));

    helper.set_Tipo(true);
    helper.help_table(ui->Lineas);
    helper.set_tarifa(1);
    helper.setDatabase("empresa","lin_alb_pro");
    helper.setidHeader(1);
    helper.blockTable(true);


    connect(ui->btnAnadirLinea,SIGNAL(clicked()),&helper,SLOT(addRow()));
    connect(ui->btn_borrarLinea,SIGNAL(clicked()),&helper,SLOT(removeRow()));
    connect(ui->chklporc_rec,SIGNAL(toggled(bool)),&helper,SLOT(set_UsarRE(bool)));


    connect(&helper,SIGNAL(lineaReady(lineaDetalle*)),this,SLOT(lineaReady(lineaDetalle*)));
    connect(&helper,SIGNAL(lineaDeleted(int)),this,SLOT(lieaDeleted(int)));
    connect(ui->tabWidget_2,SIGNAL(currentChanged(int)),this,SLOT(resizeTable(int)));


    connect(&helper,SIGNAL(totalChanged(double,double,double,double,double,double,QString)),
            this,SLOT(totalChanged(double,double,double,double,double,double,QString)));

    connect(&helper,SIGNAL(desglose1Changed(double,double,double,double)),
            this,SLOT(desglose1Changed(double,double,double,double)));

    connect(&helper,SIGNAL(desglose2Changed(double,double,double,double)),
            this,SLOT(desglose2Changed(double,double,double,double)));

    connect(&helper,SIGNAL(desglose3Changed(double,double,double,double)),
            this,SLOT(desglose3Changed(double,double,double,double)));

    connect(&helper,SIGNAL(desglose4Changed(double,double,double,double)),
            this,SLOT(desglose4Changed(double,double,double,double)));

    ui->txtporc_iva1->setText(Configuracion_global->ivaList.at(0));
    ui->txtporc_iva2->setText(Configuracion_global->ivaList.at(1));
    ui->txtporc_iva3->setText(Configuracion_global->ivaList.at(2));
    ui->txtporc_iva4->setText(Configuracion_global->ivaList.at(3));

    ui->txtporc_rec1->setText(Configuracion_global->reList.at(0));
    ui->txtporc_rec2->setText(Configuracion_global->reList.at(1));
    ui->txtporc_rec3->setText(Configuracion_global->reList.at(2));
    ui->txtporc_rec4->setText(Configuracion_global->reList.at(3));

    ui->btn_cerrar->setVisible(showCerrar);
    // ------------------------------
    // control estado widgets
    //-------------------------------
    ui->btnAnterior->setEnabled(false);
    ui->btnBorrar->setEnabled(false);
    ui->btnImprimir->setEnabled(false);
    ui->btnFacturar->setEnabled(false);
    oAlbPro->id = 0;
    ui->lblAlbaran->setText("");
    ui->lblproveedor->setText("");

    ui->lbfacturado->setVisible(false);
    ui->lblNumFactura->setVisible(false);
    ui->txtfecha_factura->setVisible(false);
    ui->txtcNumFra->setVisible(false);

    //----------------------
    // Modelo Tabla
    //----------------------
    m = new QSqlQueryModel(this);
    m->setQuery("select id,albaran,fecha,cif_proveedor,proveedor from alb_pro order by albaran desc",Configuracion_global->empresaDB);
    ui->tabla->setModel(m);
    formato_tabla();
    ui->tabla->selectRow(0);

    ui->stackedWidget->setCurrentIndex(1);

    setUpBusqueda();

    bloquearcampos(true);

    //--------------------
    // CONTROL DE EVENTOS
    //--------------------
    QList<QWidget*> l = this->findChildren<QWidget*>();
    QList<QWidget*> ::Iterator it;

    for( it = l.begin() ;it!= l.end();++it )
        (*it)->installEventFilter(this);

}
开发者ID:Ladis72,项目名称:RedFoX,代码行数:100,代码来源:frmalbaranproveedor.cpp

示例2: dropMimeData

bool QgsComposerModel::dropMimeData( const QMimeData *data,
                                     Qt::DropAction action, int row, int column, const QModelIndex &parent )
{
  if ( column != ItemId )
  {
    return false;
  }

  if ( action == Qt::IgnoreAction )
  {
    return true;
  }

  if ( !data->hasFormat( "application/x-vnd.qgis.qgis.composeritemid" ) )
  {
    return false;
  }

  if ( parent.isValid() )
  {
    return false;
  }

  int beginRow = row != -1 ? row : rowCount( QModelIndex() );

  QByteArray encodedData = data->data( "application/x-vnd.qgis.qgis.composeritemid" );
  QDataStream stream( &encodedData, QIODevice::ReadOnly );
  QList<QgsComposerItem*> droppedItems;
  int rows = 0;

  while ( !stream.atEnd() )
  {
    QString text;
    stream >> text;
    const QgsComposerItem* item = mComposition->getComposerItemByUuid( text );
    if ( item )
    {
      droppedItems << const_cast<QgsComposerItem*>( item );
      ++rows;
    }
  }

  if ( droppedItems.length() == 0 )
  {
    //no dropped items
    return false;
  }

  //move dropped items

  //first sort them by z-order
  qSort( droppedItems.begin(), droppedItems.end(), zOrderDescending );

  //calculate position in z order list to drop items at
  int destPos = 0;
  if ( beginRow < rowCount() )
  {
    QgsComposerItem* itemBefore = mItemsInScene.at( beginRow );
    destPos = mItemZList.indexOf( itemBefore );
  }
  else
  {
    //place items at end
    destPos = mItemZList.size();
  }

  //calculate position to insert moved rows to
  int insertPos = destPos;
  QList<QgsComposerItem*>::iterator itemIt = droppedItems.begin();
  for ( ; itemIt != droppedItems.end(); ++itemIt )
  {
    int listPos = mItemZList.indexOf( *itemIt );
    if ( listPos == -1 )
    {
      //should be impossible
      continue;
    }

    if ( listPos < destPos )
    {
      insertPos--;
    }
  }

  //remove rows from list
  itemIt = droppedItems.begin();
  for ( ; itemIt != droppedItems.end(); ++itemIt )
  {
    mItemZList.removeOne( *itemIt );
  }

  //insert items
  itemIt = droppedItems.begin();
  for ( ; itemIt != droppedItems.end(); ++itemIt )
  {
    mItemZList.insert( insertPos, *itemIt );
    insertPos++;
  }

  rebuildSceneItemList();
//.........这里部分代码省略.........
开发者ID:LZS1991,项目名称:SWGIS,代码行数:101,代码来源:qgscomposermodel.cpp

示例3: mousePressEvent


//.........这里部分代码省略.........
        //transform the mouse pos to scene coordinates
        QPointF scenePoint = mapToScene( e->pos() );

        visibleRect.scale( scaleFactor, scenePoint.x(), scenePoint.y() );
        QRectF boundsRect = visibleRect.toRectF();

        //zoom view to fit desired bounds
        fitInView( boundsRect, Qt::KeepAspectRatio );
      }
      break;
    }

    case Pan:
    {
      //pan action
      mToolPanning = true;
      mMouseLastXY = e->pos();
      viewport()->setCursor( Qt::ClosedHandCursor );
      break;
    }

    case MoveItemContent:
    {
      //get a list of items at clicked position
      QList<QGraphicsItem *> itemsAtCursorPos = items( e->pos() );
      if ( itemsAtCursorPos.size() == 0 )
      {
        //no items at clicked position
        return;
      }

      //find highest QgsComposerItem at clicked position
      //(other graphics items may be higher, eg selection handles)
      QList<QGraphicsItem*>::iterator itemIter = itemsAtCursorPos.begin();
      for ( ; itemIter != itemsAtCursorPos.end(); ++itemIter )
      {
        QgsComposerItem* item = dynamic_cast<QgsComposerItem *>(( *itemIter ) );
        if ( item )
        {
          //we've found the highest QgsComposerItem
          mMoveContentStartPos = scenePoint;
          mMoveContentItem = item;
          mMovingItemContent = true;
          break;
        }
      }

      //no QgsComposerItem at clicked position
      return;
    }

    case AddArrow:
    {
      mRubberBandStartPos = QPointF( snappedScenePoint.x(), snappedScenePoint.y() );
      mRubberBandLineItem = new QGraphicsLineItem( snappedScenePoint.x(), snappedScenePoint.y(), snappedScenePoint.x(), snappedScenePoint.y() );
      mRubberBandLineItem->setZValue( 1000 );
      scene()->addItem( mRubberBandLineItem );
      scene()->update();
      break;
    }

    //create rubber band for map and ellipse items
    case AddMap:
    case AddRectangle:
    case AddTriangle:
    case AddEllipse:
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:67,代码来源:qgscomposerview.cpp

示例4: prepareForFeature

void QgsAtlasComposition::prepareForFeature( int featureI )
{
  if ( !mComposerMap || !mCoverageLayer )
  {
    return;
  }

  // retrieve the next feature, based on its id
  mCoverageLayer->getFeatures( QgsFeatureRequest().setFilterFid( mFeatureIds[ featureI ] ) ).nextFeature( mCurrentFeature );
  QgsExpression::setSpecialColumn( "$atlasfeatureid", mCurrentFeature.id() );
  QgsExpression::setSpecialColumn( "$atlasgeometry", QVariant::fromValue( *mCurrentFeature.geometry() ) );

  if ( !mSingleFile && mFilenamePattern.size() > 0 )
  {
    QgsExpression::setSpecialColumn( "$feature", QVariant(( int )featureI + 1 ) );
    QVariant filenameRes = mFilenameExpr->evaluate( &mCurrentFeature, mCoverageLayer->pendingFields() );
    if ( mFilenameExpr->hasEvalError() )
    {
      throw std::runtime_error( tr( "Filename eval error: %1" ).arg( mFilenameExpr->evalErrorString() ).toLocal8Bit().data() );
    }

    mCurrentFilename = filenameRes.toString();
  }

  //
  // compute the new extent
  // keep the original aspect ratio
  // and apply a margin

  // QgsGeometry::boundingBox is expressed in the geometry"s native CRS
  // We have to transform the grometry to the destination CRS and ask for the bounding box
  // Note: we cannot directly take the transformation of the bounding box, since transformations are not linear

  QgsGeometry tgeom( *mCurrentFeature.geometry() );
  tgeom.transform( mTransform );
  QgsRectangle geom_rect = tgeom.boundingBox();

  double xa1 = geom_rect.xMinimum();
  double xa2 = geom_rect.xMaximum();
  double ya1 = geom_rect.yMinimum();
  double ya2 = geom_rect.yMaximum();
  QgsRectangle new_extent = geom_rect;

  // restore the original extent
  // (successive calls to setNewExtent tend to deform the original rectangle)
  mComposerMap->setNewExtent( mOrigExtent );

  if ( mFixedScale )
  {
    // only translate, keep the original scale (i.e. width x height)

    double geom_center_x = ( xa1 + xa2 ) / 2.0;
    double geom_center_y = ( ya1 + ya2 ) / 2.0;
    double xx = geom_center_x - mOrigExtent.width() / 2.0;
    double yy = geom_center_y - mOrigExtent.height() / 2.0;
    new_extent = QgsRectangle( xx,
                               yy,
                               xx + mOrigExtent.width(),
                               yy + mOrigExtent.height() );
  }
  else
  {
    // auto scale

    double geom_ratio = geom_rect.width() / geom_rect.height();
    double map_ratio = mOrigExtent.width() / mOrigExtent.height();

    // geometry height is too big
    if ( geom_ratio < map_ratio )
    {
      // extent the bbox's width
      double adj_width = ( map_ratio * geom_rect.height() - geom_rect.width() ) / 2.0;
      xa1 -= adj_width;
      xa2 += adj_width;
    }
    // geometry width is too big
    else if ( geom_ratio > map_ratio )
    {
      // extent the bbox's height
      double adj_height = ( geom_rect.width() / map_ratio - geom_rect.height() ) / 2.0;
      ya1 -= adj_height;
      ya2 += adj_height;
    }
    new_extent = QgsRectangle( xa1, ya1, xa2, ya2 );

    if ( mMargin > 0.0 )
    {
      new_extent.scale( 1 + mMargin );
    }
  }

  // evaluate label expressions
  QList<QgsComposerLabel*> labels;
  mComposition->composerItems( labels );
  QgsExpression::setSpecialColumn( "$feature", QVariant(( int )featureI + 1 ) );

  for ( QList<QgsComposerLabel*>::iterator lit = labels.begin(); lit != labels.end(); ++lit )
  {
    ( *lit )->setExpressionContext( &mCurrentFeature, mCoverageLayer );
  }
//.........这里部分代码省略.........
开发者ID:DoctorGana,项目名称:QGIS,代码行数:101,代码来源:qgsatlascomposition.cpp

示例5: updateWords

void WordPredict::updateWords()
{
    WeightedList list(m_max);

    int bestWord = -1;
    qreal bestWordWeight = -1.0f;

    DawgReduction<WPWord>::WordList words = reduction->words();

    for(int ii = 0; ii < words.count(); ++ii) {
#ifndef PRED_NO_INCREMENTAL_CALCULATIONS
        qreal weight = incrWeightForWord(words.at(ii));

        if(weight == -1) {
            words.at(ii)->isValid = false;
            continue;
        }

        if(words.at(ii)->isWord)
            list.addWord(weight, words.at(ii)->word);

        if(bestWord == -1 || weight < bestWordWeight) {
            bestWord = ii;
            bestWordWeight = weight;
        }
#else
        Word word;
        word.frequency = words.at(ii)->frequency;
        word.word = words.at(ii)->word;

        qreal weight = weightForWord(word);
        words.at(ii)->weight = weight;

        if(weight == -1) {
            words.at(ii)->isValid = false;
            continue;
        }

        if(words.at(ii)->isWord)
            list.addWord(weight, word.word);
        if(bestWord == -1 || weight < bestWordWeight) {
            bestWord = ii;
            bestWordWeight = weight;
        }
#endif
    }

    if(bestWord != -1)
        m_prefixedWord = words.at(bestWord)->word;
    else
        m_prefixedWord = QString();

    qreal baseWordScore = list.minWeight() * 10.0f;
    QStringList l_words = list.words();
    QList<qreal> l_weights = list.weights();
    QList<QPair<QString, qreal> > finalwords;
    for(int ii = 0; ii < l_words.count(); ++ii)
        if(l_weights.at(ii) <= baseWordScore)
            finalwords << qMakePair(l_words.at(ii), l_weights.at(ii));
    qSort(finalwords.begin(), finalwords.end());

    m_words = QStringList();
    m_weights = QList<qreal>();
    for(int ii = 0; ii < finalwords.count(); ++ii) {
        m_words << finalwords.at(ii).first;
        m_weights << finalwords.at(ii).second;
    }

    if(!m_words.isEmpty())
        m_word = m_words.first();
    else
        m_word = QString();

#ifdef PRED_DEBUG
    qWarning() << "Top words are" << l_words;
    qWarning() << "Best word is" << m_word;
    qWarning() << "Best words are" << m_words;
    qWarning() << "Best word weights are" << m_weights;
    //qWarning() << "Best word freqs are" << l_freq;
    QString xstr;
    QString ystr;
    for(int ii = 0; ii < m_points.count(); ++ii) {
        if(!ii) {
            xstr += "(" + QString::number(m_points.at(ii).x()) + ") ";
            ystr += "(" + QString::number(m_points.at(ii).y()) + ") ";
        } else {
            xstr += QString::number(m_points.at(ii).x() - m_points.at(ii - 1).x()) + " ";
            ystr += QString::number(m_points.at(ii - 1).y() - m_points.at(ii).y()) + " ";
        }
    }
    qWarning() << "X motion" << xstr;
    qWarning() << "Y motion" << ystr;

    qWarning() << "Movement: " << movementDesc();
#endif
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:96,代码来源:pred.cpp

示例6: sortByLexeme

void sortByLexeme(QStringList &sortList)
{
	// Карта для хранения строк с начальной текстовой строкой
	// Ключ карты - начальная строка, значения - остаток строки
	QMap<QString, QStringList> strMap;

	// Карта для хранения строк с начальной числовой строкой
	// Ключ карты - начальная строка, значения - остаток строки
	QMap<double, QStringList> numMap;

	QList<double> sortingKeyNum; // Лист для сортировки числовых ключей

	QStringList sortingKeyStr; // Лист для сортировки строковых ключей

	QStringList res;	// Результирующий лист

	QString temp; // Буфер для текущей обрабатываемой строки

	QString buf; // Буфер для ключа - домена

	QString str; // Буфер для одного из значений ключа - имени адреса

	QString aIter; // Буфер для строкого ключа при формировании выходного списка

	QString aIterKlein; // Буфер для строки из списка для каждой строки из списка

	double num; // Буфер для хранения ключа для числовой карты

	double aIterNum; // Буфер для числового ключа при формировании выходного списка
	
	// Заполнение карты путей
	for(int i=0; i<sortList.count(); i++)
	{
		// Загрузка в бущер текущей строки для сортировки
		temp=sortList[i];
		
		// Заполнение карты по числовому ключу
		if(temp[0].isNumber())
		{
			// Получение ключа
			buf=temp.section(QRegExp("[A-z]"), 0, 0);

			// Перевод ключа из строки в число
			num=buf.toDouble();

			// Получение значения
			str=temp.remove(buf);

			/*// Заполнение карты, если остаток строки не пустой 
			if(!str.isEmpty())
			{*/
				if(numMap.contains(num))
				{
					numMap[num]<<str;
				}
				else
				{ 
					numMap.insert(num, QStringList(str));
				}
			//}
		}
		// Заполнение карты по нечисловому ключу
		else
		{
			// Получение ключа
			buf=temp.section(QRegExp("\\d"), 0, 0);

			// Получение значения
			str=temp.remove(buf);

			/*// Заполнение карты, если остаток строки не пустой 
			if(!str.isEmpty())
			{*/
				if(strMap.contains(buf))
				{
					strMap[buf]<<str;
				}
				else
				{ 
					strMap.insert(buf, QStringList(str));
				}
			//}
		}
	}
	
	// Сортировка карты с числовым ключом
	// Сортировка значений для каждого ключа
	QMap<double, QStringList>::iterator itn=numMap.begin();
	
	for(;itn!=numMap.end(); itn++)
	{
		if(itn.value().count()>1)
		{
			sortByLexeme(itn.value());
		}
	}

	// Записей ключей в лист
	itn=numMap.begin();
	for(;itn!=numMap.end(); itn++)
//.........这里部分代码省略.........
开发者ID:EzhikTT,项目名称:NaturalSort,代码行数:101,代码来源:Function.cpp

示例7: fillTree

void NetTree::fillTree()
{
    // First let's add all the RSS

    m_rssGeneric = new MythGenericTree(
                    RSSNode, kSubFolder, false);

    // Add an upfolder
    if (m_type != DLG_TREE)
    {
          m_rssGeneric->addNode(tr("Back"), kUpFolder, true, false);
    }

    m_rssGeneric->SetData(QString("%1/mythnetvision/icons/rss.png")
         .arg(GetShareDir()));

    RSSSite::rssList::iterator i = m_rssList.begin();
    for (; i != m_rssList.end(); ++i)
    {
        ResultItem::resultList items =
                   getRSSArticles((*i)->GetTitle(), VIDEO_PODCAST);
        MythGenericTree *ret = new MythGenericTree(
                   (*i)->GetTitle(), kSubFolder, false);
        ret->SetData(qVariantFromValue(*i));
        m_rssGeneric->addNode(ret);

        // Add an upfolder
        if (m_type != DLG_TREE)
        {
            ret->addNode(tr("Back"), kUpFolder, true, false);
        }

        ResultItem::resultList::iterator it = items.begin();
        for (; it != items.end(); ++it)
        {
            AddFileNode(ret, *it);
        }
    }

    if (m_rssList.count() > 0)
        m_siteGeneric->addNode(m_rssGeneric);
    else
    {
        delete m_rssGeneric;
        m_rssGeneric = NULL;
    }

    // Now let's add all the grabber trees

    for (GrabberScript::scriptList::iterator i = m_grabberList.begin();
            i != m_grabberList.end(); ++i)
    {

        QMultiMap<QPair<QString,QString>, ResultItem*> treePathsNodes =
                           getTreeArticles((*i)->GetTitle(), VIDEO_FILE);

        QList< QPair<QString,QString> > paths = treePathsNodes.uniqueKeys();

        MythGenericTree *ret = new MythGenericTree(
                   (*i)->GetTitle(), kSubFolder, false);
        QString thumb = QString("%1mythnetvision/icons/%2").arg(GetShareDir())
                            .arg((*i)->GetImage());
        ret->SetData(qVariantFromValue(thumb));

        // Add an upfolder
        if (m_type != DLG_TREE)
        {
            ret->addNode(tr("Back"), kUpFolder, true, false);
        }

        for (QList<QPair<QString, QString> >::iterator i = paths.begin();
                i != paths.end(); ++i)
        {
            QStringList curPaths = (*i).first.split("/");
            QString dirthumb = (*i).second;
            QList<ResultItem*> videos = treePathsNodes.values(*i);
            buildGenericTree(ret, curPaths, dirthumb, videos);
        }
        m_siteGeneric->addNode(ret);
    }
}
开发者ID:rjmorse,项目名称:mythtv,代码行数:81,代码来源:nettree.cpp

示例8: computeCurve

//-----------------------------------------------------------------------------
void ctkTransferFunctionRepresentation::computeCurve()
{
  Q_D(ctkTransferFunctionRepresentation);

  int count = d->TransferFunction ? d->TransferFunction->count() : 0;
  if (count <= 0)
    {
    return;
    }

  d->TransferFunction->range(d->WorldRangeX[0], d->WorldRangeX[1]);
  d->WorldRangeY[0] = this->posY(d->TransferFunction->minValue());
  d->WorldRangeY[1] = this->posY(d->TransferFunction->maxValue());

  d->RangeXDiff   = this->computeRangeXDiff(d->rect(), d->WorldRangeX);
  d->RangeXOffSet = this->computeRangeXOffset(d->WorldRangeX);

  d->RangeYDiff   = this->computeRangeYDiff(d->rect(), d->WorldRangeY);
  d->RangeYOffSet = this->computeRangeYOffset(d->WorldRangeY);

  ctkControlPoint* startCP = d->TransferFunction->controlPoint(0);
  ctkControlPoint* nextCP = 0;

  QPointF startPos = this->mapPointToScene(startCP);

  d->Points.clear();
  d->Points << startPos;

  d->Path = QPainterPath();
  d->Path.moveTo(startPos);
  for(int i = 1; i < count; ++i)
    {
    nextCP = d->TransferFunction->controlPoint(i);
    if (this->transferFunction()->isDiscrete())
      {
      QPointF nextPos = this->mapPointToScene(nextCP);
      qreal midPosX = (startPos.x() + nextPos.x()) / 2.;

      d->Path.lineTo(QPointF(midPosX, startPos.y()));
      d->Path.lineTo(QPointF(midPosX, nextPos.y()));

      d->Points << nextPos;
      startPos = nextPos;
      if (i == count -1)
        {
        d->Path.lineTo(nextPos);
        }
      }
    else if (dynamic_cast<ctkNonLinearControlPoint*>(startCP))
      {
      QList<ctkPoint> points = this->nonLinearPoints(startCP, nextCP);
      int j;
      for (j = 1; j < points.count(); ++j)
        {
        d->Path.lineTo(this->mapPointToScene(points[j]));
        }
      j = points.count() - 1;
      d->Points << this->mapPointToScene(points[j]);
      }
    else //dynamic_cast<ctkBezierControlPoint*>(startCP))
      {
      QList<ctkPoint> points = this->bezierParams(startCP, nextCP);
      QList<ctkPoint>::iterator it = points.begin();
      QList<QPointF> bezierPoints;
      foreach(const ctkPoint& p, points)
        {
        bezierPoints << this->mapPointToScene(p);
        }
      d->Path.cubicTo(bezierPoints[1], bezierPoints[2], bezierPoints[3]);
      d->Points << bezierPoints[3];
      }
    //qDebug() << i << points[0] << points[1] << points[2] << points[3];
    delete startCP;
    startCP = nextCP;
    }
开发者ID:benoitbleuze,项目名称:CTK,代码行数:76,代码来源:ctkTransferFunctionRepresentation.cpp

示例9: file

RenderOptionsDialog::RenderOptionsDialog()
    : QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint)
{
    setWindowOpacity(0.75);
    setWindowTitle(tr("Options (double click to flip)"));
    QGridLayout *layout = new QGridLayout;
    setLayout(layout);
    layout->setColumnStretch(1, 1);

    int row = 0;

    QCheckBox *check = new QCheckBox(tr("Dynamic cube map"));
    check->setCheckState(Qt::Unchecked);
    // Dynamic cube maps are only enabled when multi-texturing and render to texture are available.
    check->setEnabled(glActiveTexture && glGenFramebuffersEXT);
    connect(check, SIGNAL(stateChanged(int)), this, SIGNAL(dynamicCubemapToggled(int)));
    layout->addWidget(check, 0, 0, 1, 2);
    ++row;

    QPalette palette;

    // Load all .par files
    // .par files have a simple syntax for specifying user adjustable uniform variables.
    QSet<QByteArray> uniforms;
    QList<QString> filter = QStringList("*.par");
    QList<QFileInfo> files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable);

    foreach (QFileInfo fileInfo, files) {
        QFile file(fileInfo.absoluteFilePath());
        if (file.open(QIODevice::ReadOnly)) {
            while (!file.atEnd()) {
                QList<QByteArray> tokens = file.readLine().simplified().split(' ');
                QList<QByteArray>::const_iterator it = tokens.begin();
                if (it == tokens.end())
                    continue;
                QByteArray type = *it;
                if (++it == tokens.end())
                    continue;
                QByteArray name = *it;
                bool singleElement = (tokens.size() == 3); // type, name and one value
                char counter[10] = "000000000";
                int counterPos = 8; // position of last digit
                while (++it != tokens.end()) {
                    m_parameterNames << name;
                    if (!singleElement) {
                        m_parameterNames.back() += "[";
                        m_parameterNames.back() += counter + counterPos;
                        m_parameterNames.back() += "]";
                        int j = 8; // position of last digit
                        ++counter[j];
                        while (j > 0 && counter[j] > '9') {
                            counter[j] = '0';
                            ++counter[--j];
                        }
                        if (j < counterPos)
                            counterPos = j;
                    }

                    if (type == "color") {
                        layout->addWidget(new QLabel(m_parameterNames.back()));
                        bool ok;
                        ColorEdit *colorEdit = new ColorEdit(it->toUInt(&ok, 16), m_parameterNames.size() - 1);
                        m_parameterEdits << colorEdit;
                        layout->addWidget(colorEdit);
                        connect(colorEdit, SIGNAL(colorChanged(QRgb,int)), this, SLOT(setColorParameter(QRgb,int)));
                        ++row;
                    } else if (type == "float") {
                        layout->addWidget(new QLabel(m_parameterNames.back()));
                        bool ok;
                        FloatEdit *floatEdit = new FloatEdit(it->toFloat(&ok), m_parameterNames.size() - 1);
                        m_parameterEdits << floatEdit;
                        layout->addWidget(floatEdit);
                        connect(floatEdit, SIGNAL(valueChanged(float,int)), this, SLOT(setFloatParameter(float,int)));
                        ++row;
                    }
                }
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:76,代码来源:scene.cpp

示例10: UpdateTimeline

void CTimelineWidget::UpdateTimeline()
{
    QLayoutItem *child;
    if(layout() != Q_NULLPTR)
    {
        while (((child = layout()->takeAt(0)) != 0)) {
            //                                    delete child->widget();
            delete child;
        }
        delete layout();
    }   
    m_pLoader->start();
    QHBoxLayout* pHBLayout = new QHBoxLayout(this);
    pHBLayout->setSpacing(6);
    pHBLayout->setContentsMargins(3, 3, 3, 3);
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, QColor(240,240,240));
    setAutoFillBackground(true);
    setPalette(Pal);

    int iLayout1 = 0;
    int iLayout2 = 0;
    QList<int> lPendingGames = QList<int>();
    for (int i = 0; i < m_pThumbnailList->length(); i++)
    {
        if (m_pThumbnailList->at(i)->GetSyncedID() != QString("")) {
            int j = FindThumbnailIndex(m_pThumbnailList->at(i)->GetSyncedID());
            if (j >= 0) {
                if (i < j)
                {
                    pHBLayout->addWidget(NewColumn(true));
                    AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
                    AddThumbnail(m_pThumbnailList->at(j), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
                    if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
                    {
                        iLayout1 = pHBLayout->count();
                        lPendingGames.append(iLayout1);
                    }
                    else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
                    {
                        iLayout2 = pHBLayout->count();
                        lPendingGames.append(iLayout2);
                    }
                }
                else
                {
                    if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
                    {
                        iLayout1 = lPendingGames.takeFirst();
                    }
                    else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
                    {
                        iLayout2 = lPendingGames.takeFirst();
                    }
                }
            }
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
        {
            if (iLayout1 >= pHBLayout->count())
            {
                pHBLayout->addWidget(NewColumn(false));

            }
            if (!AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout1)->widget()))
            {
                pHBLayout->insertWidget(iLayout1, NewColumn(false));
                AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout1)->widget());
                iLayout2++;
                for (QList<int>::Iterator g = lPendingGames.begin(); g != lPendingGames.end(); g++) {
                    (*g)++;
                }
            }
            iLayout1++;
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
        {
            if (iLayout2 >= pHBLayout->count())
            {
                pHBLayout->addWidget(NewColumn(false));
            }
            if (!AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout2)->widget()))
            {
                pHBLayout->insertWidget(iLayout2, NewColumn(false));
                AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout2)->widget());
                iLayout1++;
                for (QList<int>::Iterator g = lPendingGames.begin(); g != lPendingGames.end(); g++) {
                    (*g)++;
                }
            }
            iLayout2++;
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::BOTH_PLAYER)
        {
            pHBLayout->addWidget(NewColumn(false));
            AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
            iLayout1 = pHBLayout->count();
            iLayout2 = pHBLayout->count();
        }
    }
//.........这里部分代码省略.........
开发者ID:ludomuse,项目名称:LudoMuseEditor,代码行数:101,代码来源:CTimelineWidget.cpp

示例11: while

void MesytecMadc32UI::applySettings()
{
    applyingSettings = true;

    QList<QGroupBox*> gbs = findChildren<QGroupBox*>();
    if(!gbs.empty())
    {
        QList<QGroupBox*>::const_iterator it = gbs.begin();
        while(it != gbs.end())
        {
            QGroupBox* w = (*it);
            for(int ch=0; ch < MADC32V2_NUM_CHANNELS; ch++) {
                if(w->objectName() == tr("enable_channel%1").arg(ch)) w->setChecked(module->conf_.enable_channel[ch]);
            }
            it++;
        }
    }
    QList<QCheckBox*> cbs = findChildren<QCheckBox*>();
    if(!cbs.empty())
    {
        QList<QCheckBox*>::const_iterator it = cbs.begin();
        while(it != cbs.end())
        {
            QCheckBox* w = (*it);

            if(w->objectName() == "enable_multi_event_send_different_eob_marker") w->setChecked(module->conf_.enable_multi_event_send_different_eob_marker);
            if(w->objectName() == "enable_multi_event_compare_with_max_transfer_data") w->setChecked(module->conf_.enable_multi_event_compare_with_max_transfer_data);
            if(w->objectName() == "enable_adc_override") w->setChecked(module->conf_.enable_adc_override);
            if(w->objectName() == "enable_switch_off_sliding_scale") w->setChecked(module->conf_.enable_switch_off_sliding_scale);
            if(w->objectName() == "enable_skip_out_of_range") w->setChecked(module->conf_.enable_skip_out_of_range);
            if(w->objectName() == "enable_ignore_thresholds") w->setChecked(module->conf_.enable_ignore_thresholds);
            if(w->objectName() == "enable_termination_input_gate0") w->setChecked(module->conf_.enable_termination_input_gate0);
            if(w->objectName() == "enable_termination_input_fast_clear") w->setChecked(module->conf_.enable_termination_input_fast_clear);
            if(w->objectName() == "enable_external_time_stamp_reset") w->setChecked(module->conf_.enable_external_time_stamp_reset);

            it++;
        }
    }
    QList<QComboBox*> cbbs = findChildren<QComboBox*>();
    if(!cbbs.empty())
    {
        QList<QComboBox*>::const_iterator it = cbbs.begin();
        while(it != cbbs.end())
        {
            QComboBox* w = (*it);
            //printf("Found combobox with the name %s\n",w->objectName().toStdString().c_str());
            if(w->objectName() == "addr_source") w->setCurrentIndex(module->conf_.addr_source);
            if(w->objectName() == "multi_event_mode") w->setCurrentIndex(module->conf_.multi_event_mode);
            if(w->objectName() == "vme_mode") w->setCurrentIndex(module->conf_.vme_mode);
            if(w->objectName() == "data_length_format") w->setCurrentIndex(module->conf_.data_length_format);
            if(w->objectName() == "time_stamp_source") w->setCurrentIndex(module->conf_.time_stamp_source);
            if(w->objectName() == "adc_resolution") w->setCurrentIndex(module->conf_.adc_resolution);
            if(w->objectName() == "output_format") w->setCurrentIndex(module->conf_.output_format);
            if(w->objectName() == "gate_generator_mode") w->setCurrentIndex(module->conf_.gate_generator_mode);
            if(w->objectName() == "ecl_gate1_mode") w->setCurrentIndex(module->conf_.ecl_gate1_mode);
            if(w->objectName() == "ecl_fclear_mode") w->setCurrentIndex(module->conf_.ecl_fclear_mode);
            if(w->objectName() == "ecl_busy_mode") w->setCurrentIndex(module->conf_.ecl_busy_mode);
            if(w->objectName() == "nim_gate1_mode") w->setCurrentIndex(module->conf_.nim_gate1_mode);
            if(w->objectName() == "nim_fclear_mode") w->setCurrentIndex(module->conf_.nim_fclear_mode);
            if(w->objectName() == "input_range") {
                switch (module->conf_.input_range){
                case MesytecMadc32ModuleConfig::ir4V: w->setCurrentIndex(0); break;
                case MesytecMadc32ModuleConfig::ir8V: w->setCurrentIndex(1); break;
                case MesytecMadc32ModuleConfig::ir10V: w->setCurrentIndex(2); break;
                default: w->setCurrentIndex(2); break;
                }
            }
            if(w->objectName() == "marking_type") w->setCurrentIndex(module->conf_.marking_type);
            if(w->objectName() == "bank_operation") w->setCurrentIndex(module->conf_.bank_operation);
            if(w->objectName() == "test_pulser_mode") w->setCurrentIndex(module->conf_.test_pulser_mode);
            it++;
        }
    }
    QList<QSpinBox*> csb = findChildren<QSpinBox*>();
    if(!csb.empty())
    {
        QList<QSpinBox*>::const_iterator it = csb.begin();
        while(it != csb.end())
        {
            QSpinBox* w = (*it);
            //printf("Found spinbox with the name %s\n",w->objectName().toStdString().c_str());
            if(w->objectName() == "irq_level") w->setValue(module->conf_.irq_level);
            if(w->objectName() == "irq_vector") w->setValue(module->conf_.irq_vector);
            if(w->objectName() == "irq_threshold") w->setValue(module->conf_.irq_threshold);
            if(w->objectName() == "base_addr_register") w->setValue(module->conf_.base_addr_register);
            if(w->objectName() == "time_stamp_divisor") w->setValue(module->conf_.time_stamp_divisor);
            if(w->objectName() == "max_transfer_data") w->setValue(module->conf_.max_transfer_data);
            if(w->objectName() == "rc_module_id_read") w->setValue(module->conf_.rc_module_id_read);
            if(w->objectName() == "rc_module_id_write") w->setValue(module->conf_.rc_module_id_write);

            for(int ch=0; ch<2; ch++)
            {
                if(w->objectName() == tr("hold_delay_%1").arg(ch)) w->setValue(module->conf_.hold_delay[ch]);
                if(w->objectName() == tr("hold_width_%1").arg(ch)) w->setValue(module->conf_.hold_width[ch]);
            }
            for(int ch=0; ch<MADC32V2_NUM_CHANNELS; ch++)
            {
                if(w->objectName() == tr("thresholds%1").arg(ch)) w->setValue(module->conf_.thresholds[ch]);
            }
            it++;
//.........这里部分代码省略.........
开发者ID:mojca,项目名称:gecko,代码行数:101,代码来源:mesytecMadc32ui.cpp

示例12: MergeProxies

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
DataContainerArrayProxy DataContainerArrayProxy::MergeProxies(DataContainerArrayProxy fileProxy, DataContainerArrayProxy cacheProxy)
{
  QMap<QString, DataContainerProxy> fDcMap = fileProxy.dataContainers;
  QMap<QString, DataContainerProxy>& cDcMap = cacheProxy.dataContainers;

  // Add extra items in the file to the cache
  for (QMap<QString, DataContainerProxy>::iterator fDcIter = fDcMap.begin(); fDcIter != fDcMap.end(); ++fDcIter)
  {
    QString fileDcName = fDcIter.key();
    DataContainerProxy fileDcProxy = fDcIter.value();

    // If the cache does not have the file dc proxy, add it to the cache
    if (cDcMap.contains(fileDcName) == false)
    {
      cDcMap.insert(fileDcName, fileDcProxy);
    }

    QMap<QString, AttributeMatrixProxy> fAmMap = fileDcProxy.attributeMatricies;
    QMap<QString, AttributeMatrixProxy>& cAmMap = cDcMap.find(fileDcName).value().attributeMatricies;
    for (QMap<QString, AttributeMatrixProxy>::iterator fAmIter = fAmMap.begin(); fAmIter != fAmMap.end(); ++fAmIter)
    {
      QString fileAmName = fAmIter.key();
      AttributeMatrixProxy fileAmProxy = fAmIter.value();
      // If the cache does not have the file am proxy, add it to the cache
      if (cAmMap.contains(fileAmName) == false)
      {
        cAmMap.insert(fileAmName, fileAmProxy);
      }

      QMap<QString, DataArrayProxy> fDaMap = fileAmProxy.dataArrays;
      QMap<QString, DataArrayProxy>& cDaMap = cAmMap.find(fileAmName).value().dataArrays;
      for (QMap<QString, DataArrayProxy>::iterator fDaIter = fDaMap.begin(); fDaIter != fDaMap.end(); ++fDaIter)
      {
        QString fileDaName = fDaIter.key();
        DataArrayProxy fileDaProxy = fDaIter.value();
        // If the cache does not have the file da proxy, add it to the cache
        if (cDaMap.contains(fileDaName) == false)
        {
          cDaMap.insert(fileDaName, fileDaProxy);
        }
      }
    }
  }

  // Remove items from the cache that are no longer in the file
  QList<QString> dcItemsToDelete;
  for (QMap<QString, DataContainerProxy>::iterator cDcIter = cDcMap.begin(); cDcIter != cDcMap.end(); ++cDcIter)
  {
    QString cacheDcName = cDcIter.key();
    DataContainerProxy& cacheDcProxy = cDcIter.value();

    // If the file does not have the cached dc proxy, remove it from the cache
    if (fDcMap.contains(cacheDcName) == false)
    {
      dcItemsToDelete.push_back(cacheDcName);
    }
    else
    {
      QMap<QString, AttributeMatrixProxy>& cAmMap = cacheDcProxy.attributeMatricies;
      QMap<QString, AttributeMatrixProxy> fAmMap = fDcMap.find(cacheDcName).value().attributeMatricies;

      QList<QString> amItemsToDelete;
      for (QMap<QString, AttributeMatrixProxy>::iterator amIter = cAmMap.begin(); amIter != cAmMap.end(); ++amIter)
      {
        QString cacheAmName = amIter.key();
        AttributeMatrixProxy& cacheAmProxy = amIter.value();
        // If the file does not have the cached am proxy, remove it from the cache
        if (fAmMap.contains(cacheAmName) == false)
        {
          amItemsToDelete.push_back(cacheAmName);
        }
        else
        {
          QMap<QString, DataArrayProxy>& cDaMap = cacheAmProxy.dataArrays;
          QMap<QString, DataArrayProxy> fDaMap = fAmMap.find(cacheAmName).value().dataArrays;

          QList<QString> daItemsToDelete;
          for (QMap<QString, DataArrayProxy>::iterator daIter = cDaMap.begin(); daIter != cDaMap.end(); ++daIter)
          {
            QString cacheDaName = daIter.key();
            DataArrayProxy cacheDaProxy = daIter.value();
            // If the file does not have the cached da proxy, remove it from the cache
            if (fDaMap.contains(cacheDaName) == false)
            {
              daItemsToDelete.push_back(cacheDaName);
            }
          }
          // Remove extra da entries from cache
          for (QList<QString>::iterator iter = daItemsToDelete.begin(); iter != daItemsToDelete.end(); ++iter)
          {
            cDaMap.remove(*iter);
          }
        }
      }
      // Remove extra am entries from cache
      for (QList<QString>::iterator iter = amItemsToDelete.begin(); iter != amItemsToDelete.end(); ++iter)
      {
//.........这里部分代码省略.........
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:101,代码来源:DataContainerArrayProxy.cpp

示例13: f

bool
UnixMakefileGenerator::findLibraries()
{
    ProString libArg = project->first("QMAKE_L_FLAG");
    if (libArg == "-L")
        libArg.clear();
    QList<QMakeLocalFileName> libdirs;
    int libidx = 0;
    foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
        libdirs.append(QMakeLocalFileName(dlib.toQString()));
    static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
    for (int i = 0; lflags[i]; i++) {
        ProStringList &l = project->values(lflags[i]);
        for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {
            QString stub, dir, extn, opt = (*it).trimmed().toQString();
            if(opt.startsWith("-")) {
                if(opt.startsWith("-L")) {
                    QString lib = opt.mid(2);
                    QMakeLocalFileName f(lib);
                    int idx = libdirs.indexOf(f);
                    if (idx >= 0 && idx < libidx) {
                        it = l.erase(it);
                        continue;
                    }
                    libdirs.insert(libidx++, f);
                    if (!libArg.isEmpty())
                        *it = libArg + lib;
                } else if(opt.startsWith("-l")) {
                    if (project->isActiveConfig("rvct_linker") || project->isActiveConfig("armcc_linker")) {
                        (*it) = "lib" + opt.mid(2) + ".so";
                    } else if (project->isActiveConfig("ti_linker")) {
                        (*it) = opt.mid(2);
                    } else {
                        stub = opt.mid(2);
                    }
                } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
                    if (opt.length() == 10)
                        ++it;
                    // Skip
                }
            } else {
                extn = dir = "";
                stub = opt;
                int slsh = opt.lastIndexOf(Option::dir_sep);
                if(slsh != -1) {
                    dir = opt.left(slsh);
                    stub = opt.mid(slsh+1);
                }
                QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
                if(stub_reg.exactMatch(stub)) {
                    stub = stub_reg.cap(1);
                    extn = stub_reg.cap(2);
                }
            }
            if(!stub.isEmpty()) {
                stub += project->first(ProKey("QMAKE_" + stub.toUpper() + "_SUFFIX")).toQString();
                bool found = false;
                ProStringList extens;
                if(!extn.isNull())
                    extens << extn;
                else
                    extens << project->values("QMAKE_EXTENSION_SHLIB").first() << "a";
                for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
                    if(dir.isNull()) {
                        for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
                            QString pathToLib = ((*dep_it).local() + Option::dir_sep
                                    + project->values("QMAKE_PREFIX_SHLIB").first()
                                    + stub + "." + (*extit));
                            if(exists(pathToLib)) {
                                (*it) = "-l" + stub;
                                found = true;
                                break;
                            }
                        }
                    } else {
                        QString lib = dir + project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit);
                        if (exists(lib)) {
                            (*it) = lib;
                            found = true;
                            break;
                        }
                    }
                }
                if(!found && project->isActiveConfig("compile_libtool")) {
                    for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
                        if(exists(libdirs[dep_i].local() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext)) {
                            (*it) = libdirs[dep_i].real() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext;
                            found = true;
                            break;
                        }
                    }
                }
            }
            ++it;
        }
    }
    return false;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:98,代码来源:unixmake.cpp

示例14: findRecipes

void IngredientMatcherDialog::findRecipes( void )
{
	KApplication::setOverrideCursor( Qt::WaitCursor );

	START_TIMER("Ingredient Matcher: loading database data");

	RecipeList rlist;
	database->loadRecipes( &rlist, RecipeDB::Title | RecipeDB::NamesOnly | RecipeDB::Ingredients | RecipeDB::IngredientAmounts );

	END_TIMER();
	START_TIMER("Ingredient Matcher: analyzing data for matching recipes");

	// Clear the list
	recipeListView->listView() ->clear();

	// Now show the recipes with ingredients that are contained in the previous set
	// of ingredients
	RecipeList incompleteRecipes;
	QList <int> missingNumbers;
	Q3ValueList <IngredientList> missingIngredients;

	RecipeList::Iterator it;
	for ( it = rlist.begin();it != rlist.end();++it ) {
		IngredientList il = ( *it ).ingList;
		if ( il.isEmpty() )
			continue;

		IngredientList missing;
		if ( m_ingredientList.containsSubSet( il, missing, true, database ) ) {
			new CustomRecipeListItem( recipeListView->listView(), *it );
		}
		else {
			incompleteRecipes.append( *it );
			missingIngredients.append( missing );
			missingNumbers.append( missing.count() );
		}
	}
	END_TIMER();

	//Check if the user wants to show missing ingredients

	if ( missingNumberSpinBox->value() == 0 ) {
		KApplication::restoreOverrideCursor();
		return ;
	} //"None"



	START_TIMER("Ingredient Matcher: searching for and displaying partial matches");

	IngredientList requiredIngredients;
	for ( Q3ListViewItem *it = ingListView->listView()->firstChild(); it; it = it->nextSibling() ) {
		if ( ((Q3CheckListItem*)it)->isOn() )
			requiredIngredients << *m_item_ing_map[it];
	}

	// Classify recipes with missing ingredients in different lists by amount
	QList<int>::Iterator nit;
	Q3ValueList<IngredientList>::Iterator ilit;
	int missingNoAllowed = missingNumberSpinBox->value();

	if ( missingNoAllowed == -1 )  // "Any"
	{
		for ( nit = missingNumbers.begin();nit != missingNumbers.end();++nit )
			if ( ( *nit ) > missingNoAllowed )
				missingNoAllowed = ( *nit );
	}


	for ( int missingNo = 1; missingNo <= missingNoAllowed; missingNo++ ) {
		nit = missingNumbers.begin();
		ilit = missingIngredients.begin();

		bool titleShownYet = false;

		for ( it = incompleteRecipes.begin();it != incompleteRecipes.end();++it, ++nit, ++ilit ) {
			if ( !( *it ).ingList.containsAny( m_ingredientList ) )
				continue;

			if ( !( *it ).ingList.containsSubSet( requiredIngredients ) )
				continue;

			if ( ( *nit ) == missingNo ) {
				if ( !titleShownYet ) {
					new SectionItem( recipeListView->listView(), i18ncp( "@label:textbox", "You are missing 1 ingredient for:", "You are missing %1 ingredients for:", missingNo ) );
					titleShownYet = true;
				}
				new CustomRecipeListItem( recipeListView->listView(), *it, *ilit );
			}
		}
	}
	END_TIMER();

	KApplication::restoreOverrideCursor();
}
开发者ID:nasenbaer89,项目名称:KRecipes,代码行数:95,代码来源:ingredientmatcherdialog.cpp

示例15: if


//.........这里部分代码省略.........
  if (!aboutData->copyrightStatement().isEmpty())
    appPageText += '\n' + aboutData->copyrightStatement() + '\n';

  K3AboutContainer *appPage = addContainerPage( i18n("&About"));

  QLabel *appPageLabel = new QLabel( appPageText, 0 );
  appPage->addWidget( appPageLabel );

  if (!aboutData->homepage().isEmpty())
  {
    QLabel *url = new QLabel(appPage);
    url->setOpenExternalLinks(true);
    url->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    url->setText(QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()));
    appPage->addWidget( url );
  }

  int authorCount = aboutData->authors().count();
  if (authorCount)
  {
    QString authorPageTitle = authorCount == 1 ?
      i18n("A&uthor") : i18n("A&uthors");
    K3AboutContainer *authorPage = addScrolledContainerPage( authorPageTitle, Qt::AlignLeft, Qt::AlignLeft );

    if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
    {
      QString text;
      QLabel* activeLabel = new QLabel( authorPage );
      activeLabel->setOpenExternalLinks(true);
      activeLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
      if (!aboutData->customAuthorTextEnabled())
      {
        if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "[email protected]")
          text = i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n" );
        else {
          if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
          {
            text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ,  aboutData->authors().first().emailAddress() ,  aboutData->authors().first().emailAddress() );
          }
          else {
            text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" , aboutData->bugAddress(), aboutData->bugAddress() );
          }
        }
      }
      else
      {
        text = aboutData->customAuthorRichText();
      }
      activeLabel->setText( text );
      authorPage->addWidget( activeLabel );
    }

    QList<KAboutPerson> lst = aboutData->authors();
    for (int i = 0; i < lst.size(); ++i)
    {
      authorPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
      lst.at(i).webAddress(), lst.at(i).task() );
    }
  }

  int creditsCount = aboutData->credits().count();
  if (creditsCount)
  {
    K3AboutContainer *creditsPage = addScrolledContainerPage( i18n("&Thanks To") );

    QList<KAboutPerson> lst = aboutData->credits();
    for (int i = 0; i < lst.size(); ++i)
    {
      creditsPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
           lst.at(i).webAddress(), lst.at(i).task() );
    }
  }

  const QList<KAboutPerson> translatorList = aboutData->translators();

  if(translatorList.count() > 0)
  {
      QString text = "<qt>";

      QList<KAboutPerson>::ConstIterator it;
      for(it = translatorList.begin(); it != translatorList.end(); ++it)
      {
        text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
            "<a href=\"mailto:%2\">%2</a></p>")
            .arg((*it).name())
            .arg((*it).emailAddress())
            .arg((*it).emailAddress());
      }

      text += KAboutData::aboutTranslationTeam() + "</qt>";
      addTextPage( i18n("T&ranslation"), text, true);
  }

  if (!aboutData->license().isEmpty() )
  {
    addLicensePage( i18n("&License Agreement"), aboutData->license() );
  }
  // Make sure the dialog has a reasonable width
  setInitialSize( QSize(400,1) );
}
开发者ID:ssj-gz,项目名称:emscripten-kdelibs,代码行数:101,代码来源:k3aboutapplication.cpp


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