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


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

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


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

示例1: restart

void Gypsy::restart( const QList<KCard*> & cards )
{
    QList<KCard*> cardList = cards;

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), false, store[round]->pos() + QPointF(-2*deck()->cardWidth(),-1.1*deck()->cardHeight()));

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-3*deck()->cardWidth(),-1.6*deck()->cardHeight()));

    for ( int round = 0; round < 8; ++round )
        addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-4*deck()->cardWidth(),-2.1*deck()->cardHeight()));

    while ( !cardList.isEmpty() )
    {
        KCard * c = cardList.takeFirst();
        c->setPos( talon->pos() );
        c->setFaceUp( false );
        talon->add( c );
    }

    startDealAnimation();

    emit newCardsPossible(true);
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: takeLast

void tst_QList::takeLast() const
{
    QList<QString> list;
    list << "foo" << "bar" << "baz";

    QCOMPARE(list.takeLast(), QLatin1String("baz"));
    QCOMPARE(list.takeLast(), QLatin1String("bar"));
    QCOMPARE(list.takeLast(), QLatin1String("foo"));
}
开发者ID:KDE,项目名称:android-qt,代码行数:9,代码来源:tst_qlist.cpp

示例3: getFileInfoList

int ArchiveExtractor::getFileInfoList(const QString &path,
                                      std::vector<ArchiveFileInfo> &list) const
{
    QFile archiveFile(path);

    // Try to open as ZIP
    QuaZip zip(&archiveFile);
    if (zip.open(QuaZip::mdUnzip))
    {
        zip.setFileNameCodec("UTF-8");
        QList<QuaZipFileInfo> zipList = zip.getFileInfoList();
        while(!zipList.empty())
        {
            const QuaZipFileInfo fi = zipList.takeLast();
            list.emplace_back(fi.name, fi.dateTime, fi.uncompressedSize);
        }
        zip.close();
        if (zip.getZipError() != UNZ_OK)
        {
            qWarning("testRead(): zip.close(): %d", zip.getZipError());
            return 1;
        }
        return 0;
    }

    // Try to open as RAR
    if (ArchiveRar::loadlib())
    {
        if (ArchiveRar::getFileInfoList(path, list) == 0)
        {
            return 0;
        }
    }
    return 1;
}
开发者ID:nikola-kocic,项目名称:KIV,代码行数:35,代码来源:archiveextractor.cpp

示例4: karbonSimplifyPath

// TODO: rename to simplify subpath
void karbonSimplifyPath( KoPathShape *path, qreal error )
{
    if ( path->pointCount() == 0 )
        return;

    removeDuplicates( path );

    bool isClosed = path->isClosedSubpath(0);
    if ( isClosed )
    {
        // insert a copy of the first point at the end
        KoPathPoint *firstPoint = path->pointByIndex( KoPathPointIndex(0, 0) );
        KoPathPointIndex end( 0, path->pointCount() );
        path->insertPoint( new KoPathPoint(*firstPoint), end );
    }

    QList<KoSubpath *> subpaths = split( *path );
    foreach ( KoSubpath *subpath, subpaths )
        subdivide( subpath );

    simplifySubpaths( &subpaths, error );
    mergeSubpaths( subpaths, path );

    while ( ! subpaths.isEmpty() )
    {
        KoSubpath *subpath = subpaths.takeLast();
        qDeleteAll( *subpath );
        delete subpath;
    }

    if ( isClosed )
        path->closeMerge();
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:34,代码来源:KarbonSimplifyPath.cpp

示例5: deleteItem

void ArchivingRulesDialog::deleteItem()
{
  _changed = true;
  saveBtn->setDisabled(false);
  
  QList<QTableWidgetItem*> selectedItems = archivingItemsTbl->selectedItems();

  QList<int> itemsToRemove;
  QTableWidgetItem* item;

  if (selectedItems.size() > 0)
  {
    itemsToRemove.clear();

    for(int i=0; i<selectedItems.size(); i++)
    {
      item = selectedItems.at(i);
      if(item->column() != 0)
        continue;

      itemsToRemove.push_front(item->row());
    }

    qSort(itemsToRemove.begin(), itemsToRemove.end());

    for(int i = 0; i < itemsToRemove.size();)
      archivingItemsTbl->removeRow(itemsToRemove.takeLast());
  }
}
开发者ID:gqueiroz,项目名称:terrama2,代码行数:29,代码来源:ArchivingRulesDialog.cpp

示例6: multiVal

void TestPointer::multiVal(int count)
{
	QAtomicInt											counter;
	QList<Pointer<PointerClass> >		ptrList;
	
	QVERIFY(counter == 0);
	
	// Create pointer
	for(int i = 0; i < count; i++)
	{
		ptrList.append(Pointer<PointerClass>(new PointerClass(counter)));
		
		QVERIFY(ptrList.last() != 0);
		QVERIFY(counter == i + 1);
		QVERIFY(ptrList.last()->testFunc());
	}
	
	// Remove pointer (all but one)
	for(int i = count - 1; i > 0; i--)
	{
		ptrList.removeLast();
		
		QVERIFY(ptrList.last() != 0);
		QVERIFY(counter == i);
		QVERIFY(ptrList.last()->testFunc());
	}
	
	Pointer<PointerClass>	ptr(ptrList.takeLast());
	ptr	=	0;
	
	QVERIFY(ptr == 0);
	QVERIFY(counter == 0);
}
开发者ID:HardcorEViruS,项目名称:MessageBus,代码行数:33,代码来源:testpointer.cpp

示例7: restart

void Fortyeight::restart( const QList<KCard*> & cards )
{
    lastdeal = false;

    QList<KCard*> cardList = cards;

    for ( int r = 0; r < 4; ++r )
    {
        for ( int column = 0; column < 8; ++column )
        {
            QPointF initPos = stack[column]->pos() - QPointF( 0, 2 * deck()->cardHeight() );
            addCardForDeal( stack[column], cardList.takeLast(), true, initPos );
        }
    }

    while ( !cardList.isEmpty() )
    {
        KCard * c = cardList.takeFirst();
        c->setPos( talon->pos() );
        c->setFaceUp( false );
        talon->add( c );
    }

    startDealAnimation();

    flipCardToPile( talon->topCard(), pile, DURATION_MOVE );

    emit newCardsPossible( true );
}
开发者ID:KDE,项目名称:kpat,代码行数:29,代码来源:fortyeight.cpp

示例8: handle

 void handle(const ResultRecord &r) override
 {
     const Value& stack = r["stack"];
     int first = stack[0]["level"].toInt();
     QList<KDevelop::FrameStackModel::FrameItem> frames;
     for (int i = 0; i< stack.size(); ++i) {
         const Value& frame = stack[i];
         KDevelop::FrameStackModel::FrameItem f;
         f.nr = frame["level"].toInt();
         f.name = getFunctionOrAddress(frame);
         QPair<QString, int> loc = getSource(frame);
         f.file = QUrl::fromLocalFile(loc.first);
         f.line = loc.second;
         frames << f;
     }
     bool hasMore = false;
     if (!frames.isEmpty()) {
         if (frames.last().nr == m_to+1) {
             frames.takeLast();
             hasMore = true;
         }
     }
     if (first == 0) {
         model->setFrames(m_thread, frames);
     } else {
         model->insertFrames(m_thread, frames);
     }
     model->setHasMoreFrames(m_thread, hasMore);
 }
开发者ID:alstef,项目名称:kdevelop,代码行数:29,代码来源:miframestackmodel.cpp

示例9: CheckForLogChanges

void HearthstoneLogWatcher::CheckForLogChanges() {
  QFile file( mPath );
  if( !file.open( QIODevice::ReadOnly ) ) {
    return;
  }

  qint64 size = file.size();
  if( size < mLastSeekPos ) {
    DBG( "Log truncation detected. This is OK if game was restarted." );
    mLastSeekPos = 0;
  } else {
    // Use raw QFile instead of QTextStream
    // QTextStream uses buffering and seems to skip some lines (see also QTextStream#pos)
    file.seek( mLastSeekPos );

    QByteArray buf = file.readAll();
    QList< QByteArray > lines = buf.split('\n');

    QByteArray lastLine = lines.takeLast();
    for( const QByteArray& line : lines ) {
      emit LineAdded( QString::fromUtf8( line.trimmed() ) );
    }

    mLastSeekPos = file.pos() - lastLine.size();
  }
}
开发者ID:MuadDibAtreides,项目名称:track-o-bot,代码行数:26,代码来源:HearthstoneLogWatcher.cpp

示例10: refreshData

void MainWindow::refreshData()
{
  MultimeterAdapter::ReadingsList readings = adapter->getCurrentReadings();

  QList<QLabel *> labels = ui->currentReadings->findChildren<QLabel*>("reading");

  while(readings.count() > labels.count())
  {
    QLabel *label = new QLabel();
    label->setObjectName("reading");
    ui->currentReadings->layout()->addWidget(label);
    labels.append(label);
  }

  while(readings.count() < labels.count())
  {
    delete labels.takeLast();
  }

  for (int i = 0; i < labels.count(); i++)
  {
      QLabel* label = labels.at(i);

      label->setText(QString("%1 %2").arg(readings.at(i).second,5,'f',4).arg(SampleSeries::toString(readings.at(i).first)));

      QPalette palette;

      palette.setColor(QPalette::WindowText, getColor(readings.at(i).first));
      label->setPalette(palette);
  }

  ui->plot->replot();
}
开发者ID:amesser,项目名称:mmgui,代码行数:33,代码来源:mainwindow.cpp

示例11: multiRef

void TestPointer::multiRef(int count)
{
	QAtomicInt											counter;
	PointerClass									*	ptrClass	=	new PointerClass(counter);
	QList<Pointer<PointerClass> >		ptrList;
	
	QVERIFY(counter.fetchAndAddOrdered(0) == 1);
	
	// Create pointer
	for(int i = 0; i < count; i++)
	{
		ptrList.append(Pointer<PointerClass>(ptrClass));
		
		QVERIFY(ptrList.last() != 0);
		QVERIFY(counter.fetchAndAddOrdered(0) == 1);
		QVERIFY(ptrList.last()->testFunc());
	}
	
	// Remove pointer (all but one)
	for(int i = count - 1; i > 0; i--)
	{
		ptrList.removeLast();
		
		QVERIFY(ptrList.last() != 0);
		QVERIFY(counter.fetchAndAddOrdered(0) == 1);
		QVERIFY(ptrList.last()->testFunc());
	}
	
	Pointer<PointerClass>	ptr(ptrList.takeLast());
	ptr	=	0;
	
	QVERIFY(ptr == 0);
	QVERIFY(counter.fetchAndAddOrdered(0) == 0);
}
开发者ID:HardcorEViruS,项目名称:MessageBus,代码行数:34,代码来源:testpointer.cpp

示例12: getTilesInView

void MapView::getTilesInView()
{
    if (MapSource.id == None) return;

    QRectF viewRect = mapToScene(0,0,width(),height()).boundingRect();
    QList<QPoint> XYTileList = getXYTileInRange(currentZoom,
                                                getLongFromMercatorX(viewRect.x()+viewRect.width()),
                                                getLongFromMercatorX(viewRect.x()),
                                                getLatFromMercatorY(viewRect.y()),
                                                getLatFromMercatorY(viewRect.y()+viewRect.height()) );
    QPoint p1 = XYTileList.first();
    QPoint p2 = XYTileList.last();
    QPointF center = QPointF( (p2.x()+p1.x()) / 2. , (p1.y()+p2.y()) / 2. );

    //sorts list so that points closest to center are loaded first
    QMap<qreal, QPoint> map;
    for(int i=0;i<XYTileList.size();++i) map.insertMulti(lengthSquared((XYTileList.at(i))-center),XYTileList.at(i));

    XYTileList = map.values();

    QPoint p;
    while(XYTileList.size()>0)
    {
        if (currentRequests.count()<requestLimit) p = XYTileList.takeFirst();
        else p = XYTileList.takeLast();

        if (!tilePlaced(p,currentZoom)) getTile(p.x(),p.y(),currentZoom);
    }

    qDebug("Number of items in scene: "+QString::number(scene()->items().count()));
}
开发者ID:mueslo,项目名称:TEA,代码行数:31,代码来源:mapview.cpp

示例13: removeSelections

void KNMusicTreeViewBase::removeSelections()
{
    //Check is the current playing item is in the selection.
    if(KNMusicGlobal::nowPlaying()->playingModel()!=nullptr &&
            KNMusicGlobal::nowPlaying()->playingModel()->sourceModel()==
            m_proxyModel->sourceModel())
    {
        //Get the current playing index first.
        QModelIndex currentPlayingIndex=
                m_proxyModel->mapFromSource(KNMusicGlobal::nowPlaying()->currentPlayingIndex());
        //Check is the playing index is in the selection.
        if(selectionModel()->selectedIndexes().contains(currentPlayingIndex))
        {
            //If so, ask now playing to reset current playing.
            KNMusicGlobal::nowPlaying()->resetCurrentPlaying();
        }
    }
    //Get the current indexes.
    QModelIndexList selectionList=selectionModel()->selectedRows(m_proxyModel->playingItemColumn());
    //Change the model index list to persistent index.
    QList<QPersistentModelIndex> persistentList;
    while(!selectionList.isEmpty())
    {
        persistentList.append(m_proxyModel->mapToSource(selectionList.takeLast()));
    }
    //Remove all the indexes.
    while(!persistentList.isEmpty())
    {
        QPersistentModelIndex currentRemovedIndex=persistentList.takeLast();
        if(currentRemovedIndex.isValid())
        {
            m_proxyModel->removeSourceMusicRow(currentRemovedIndex.row());
        }
    }
}
开发者ID:AG3,项目名称:Mu,代码行数:35,代码来源:knmusictreeviewbase.cpp

示例14: putConnection

		void putConnection(HttpConnection* connection)
		{
			while (reservedConnections.size() >= MaximumReserveCount)
				delete reservedConnections.takeLast();

			reservedConnections.append(connection);
		}
开发者ID:acossette,项目名称:pillow,代码行数:7,代码来源:HttpServer.cpp

示例15: takeConnection

		HttpConnection* takeConnection()
		{
			if (reservedConnections.isEmpty())
				return createConnection();
			else
				return reservedConnections.takeLast();
		}
开发者ID:acossette,项目名称:pillow,代码行数:7,代码来源:HttpServer.cpp


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