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


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

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


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

示例1: mouseReleaseEvent

/*---------------------------------------------------------------------------------------------
 * (function: mouseReleaseEvent)
 *-------------------------------------------------------------------------------------------*/
void ExplorerScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
    if (line != 0 && myMode == InsertLine) {
        QList<QGraphicsItem *> startItems = items(line->line().p1());
        if (startItems.count() && startItems.first() == line)
            startItems.removeFirst();
        QList<QGraphicsItem *> endItems = items(line->line().p2());
        if (endItems.count() && endItems.first() == line)
            endItems.removeFirst();

        removeItem(line);
        delete line;


        if (startItems.count() > 0 && endItems.count() > 0 &&
            startItems.first()->type() == LogicUnit::Type &&
            endItems.first()->type() == LogicUnit::Type &&
            startItems.first() != endItems.first()) {
            LogicUnit *startItem =
                qgraphicsitem_cast<LogicUnit *>(startItems.first());
            LogicUnit *endItem =
                qgraphicsitem_cast<LogicUnit *>(endItems.first());
            Wire *wire = new Wire(startItem, endItem);
            wire->setColor(myLineColor);
            startItem->addConnection(wire);
            endItem->addConnection(wire);
            wire->setZValue(-1000.0);
            addItem(wire);
            wire->updatePosition();
        }
    }

    line = 0;
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
开发者ID:amusant,项目名称:vtr-verilog-to-routing,代码行数:38,代码来源:explorerscene.cpp

示例2: mouseReleaseEvent

//----------------------------------------------------------------------------------------------
void GraphScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *p_mouseEvent)
{
    if (m_pConnectionLine != 0 && m_pointerMode == MODE_Connect) 
    {
        QList<QGraphicsItem *> startItems = items(m_pConnectionLine->line().p1());
        if (startItems.count() && startItems.first() == m_pConnectionLine)
            startItems.removeFirst();

        QList<QGraphicsItem *> endItems = items(m_pConnectionLine->line().p2());
        if (endItems.count() && endItems.first() == m_pConnectionLine)
            endItems.removeFirst();

        removeItem(m_pConnectionLine);
        delete m_pConnectionLine;

        if (startItems.count() > 0 && endItems.count() > 0 &&
            startItems.first() != endItems.first()) 
        {
            GraphNodeView *pStartNode = qgraphicsitem_cast<GraphNodeView *>(startItems.first());
            GraphNodeView *pEndNode = qgraphicsitem_cast<GraphNodeView *>(endItems.first());

            if (pStartNode != nullptr &&
                pEndNode != nullptr)
            {
                m_pGraph->AddEdge(pStartNode->ModelId(), pEndNode->ModelId());
                ConnectNodeViews(pStartNode, pEndNode);
            }
        }
    }

    m_pConnectionLine = nullptr;
    QGraphicsScene::mouseReleaseEvent(p_mouseEvent);
}
开发者ID:mabdelmonemali,项目名称:IStrategizer,代码行数:34,代码来源:GraphScene.cpp

示例3: sort

//================================================================
void SampleIDInfoWidget::sort(QList<int> order)
{

    QList<QTreeWidgetItem*> items;

    while (!order.isEmpty())
    {
        if (mView->topLevelItemCount() == 0)
            break;



        for (int i=0; i< mView->topLevelItemCount(); ++i)
        {
            int name = mView->topLevelItem(i)->text(2).split("#").at(1).toInt();
            qDebug()<<name<<" "<<order;

            if (name == order.first())
            {
                items.append(mView->takeTopLevelItem(i));
                order.removeFirst();
                break;
            }

            if (i == mView->topLevelItemCount()-1)
                order.removeFirst();
        }


    }

    mView->addTopLevelItems(items);
}
开发者ID:dridk,项目名称:sampleIDViewer,代码行数:34,代码来源:sampleidinfowidget.cpp

示例4: mouseReleaseEvent

//! [11]
void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
    if (line != 0 && myMode == InsertLine) {
        QList<QGraphicsItem *> startItems = items(line->line().p1());
        if (startItems.count() && startItems.first() == line)
            startItems.removeFirst();
        QList<QGraphicsItem *> endItems = items(line->line().p2());
        if (endItems.count() && endItems.first() == line)
            endItems.removeFirst();

        removeItem(line);
        delete line;
//! [11] //! [12]

        if (startItems.count() > 0 && endItems.count() > 0 &&
            startItems.first()->type() == DiagramItem::Type &&
            endItems.first()->type() == DiagramItem::Type &&
            startItems.first() != endItems.first()) {
            DiagramItem *startItem =
                qgraphicsitem_cast<DiagramItem *>(startItems.first());
            DiagramItem *endItem =
                qgraphicsitem_cast<DiagramItem *>(endItems.first());
            Arrow *arrow = new Arrow(startItem, endItem);
            arrow->setColor(myLineColor);
            startItem->addArrow(arrow);
            endItem->addArrow(arrow);
            arrow->setZValue(-1000.0);
            addItem(arrow);
            arrow->updatePosition();
        }
    }
//! [12] //! [13]
    line = 0;
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:36,代码来源:diagramscene.cpp

示例5: mouseReleaseEvent

void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
    if (line != 0 && myMode == InsertLine)
    {
        QList<QGraphicsItem *> startItems = items(line->line().p1());
        if (startItems.count() && startItems.first() == line)
            startItems.removeFirst();
        QList<QGraphicsItem *> endItems = items(line->line().p2());
        if (endItems.count() && endItems.first() == line)
            endItems.removeFirst();

        removeItem(line);
        delete line;

        if (startItems.count() > 0 && endItems.count() > 0 &&
                startItems.first()->type() == Connector::Type &&
                endItems.first()->type() == Connector::Type &&
                startItems.first() != endItems.first())
        {
            Connector *startItem =
                    qgraphicsitem_cast<Connector *>(startItems.first());
            Connector *endItem =
                    qgraphicsitem_cast<Connector *>(endItems.first());
            QDomNode arrowXml =  createArrowXml(startItem,endItem);
            Arrow *arrow = new Arrow(startItem, endItem,arrowXml);

            arrowList.append(arrow);
            arrow->setColor(myLineColor);
            startItem->addArrow(arrow);
            endItem->addArrow(arrow);
            arrow->setZValue(-1000.0);
            addItem(arrow);
            arrow->updatePosition();

        }
    }

    line = 0;
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
    if(myMode == MoveItem)
    {
        DiagramItem* item =(DiagramItem*)itemAt(mouseEvent->scenePos());
        if(item == 0)
            return;
        if(item->type() == DiagramItem::Type)
            {
                item->updatePoz();
                ((DiagramWindow*)parent())->updateXml();
            }
    }
}
开发者ID:andreimariusdincu,项目名称:WHC-IDE,代码行数:51,代码来源:diagramscene.cpp

示例6: mouseReleaseEvent

void BTEditorScene::mouseReleaseEvent( QGraphicsSceneMouseEvent *mouseEvent )
{
	switch (m_mode)
	{
	case Mode::Drag:
		break;
	case Mode::InsertItem:
		break;
	case Mode::InsertLine:
		if (m_drawingLine)
		{
			QList<QGraphicsItem *> startItems = items(m_drawingLine->line().p1());
			if (startItems.count() && startItems.first() == m_drawingLine)
			{
				startItems.removeFirst();
			}
			QList<QGraphicsItem *> endItems = items(m_drawingLine->line().p2());
			if (endItems.count() && endItems.first() == m_drawingLine)
			{
				endItems.removeFirst();
			}

			removeItem(m_drawingLine);
			m_drawingLine = nullptr;

			if (startItems.count() > 0 && endItems.count() > 0 &&
				startItems.first()->type() == BTEditorItem::Type &&
				endItems.first()->type() == BTEditorItem::Type &&
				startItems.first() != endItems.first()) 
			{
				BTEditorItem *startItem = qgraphicsitem_cast<BTEditorItem *>(startItems.first());
				BTEditorItem *endItem = qgraphicsitem_cast<BTEditorItem *>(endItems.first());

				BTEditorArrow *arrow = new BTEditorArrow(startItem, endItem);
				arrow->setColor(m_lineColor);
				startItem->addArrow(arrow);
				endItem->addArrow(arrow);
				arrow->setZValue(-1000.0);
				addItem(arrow);
				arrow->updatePosition();
			}
		}
		break;
	default:
		break;
	}

	QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
开发者ID:RayRiver,项目名称:QBTEditor,代码行数:49,代码来源:BTEditorScene.cpp

示例7: getAdmin1TranslationSubs

bool getAdmin1TranslationSubs(QString const &pathFile,
                              QList<QString> &listAdmin1Subs)
{
    QFile inputFile(pathFile);
    if(inputFile.open(QIODevice::ReadOnly))   {
        QString before = "\"";
        QString after = "";
        QTextStream in(&inputFile);
        while(!in.atEnd())   {
            QString line = in.readLine();

            // sometimes quotes are added in to
            // the translation substitutes file
            // so they should be removed
            line.replace(before,after);

            listAdmin1Subs.push_back(line);
        }

        listAdmin1Subs.removeFirst();   // should be 'BEGIN'
        listAdmin1Subs.removeLast();    // should be 'END'

        return true;
    }
    else   {
        return false;
    }
}
开发者ID:preet,项目名称:shp2adminraster,代码行数:28,代码来源:shp2adminraster.cpp

示例8: query

//-----------------------------------------------------------------------------
void
QGCCacheWorker::_pruneCache(QGCMapTask* mtask)
{
    if(!_valid) {
        mtask->setError("No Cache Database");
        return;
    }
    QGCPruneCacheTask* task = static_cast<QGCPruneCacheTask*>(mtask);
    QSqlQuery query(*_db);
    QString s;
    s = QString("SELECT tileID, size, hash FROM Tiles WHERE tileID IN (SELECT tileID FROM SetTiles WHERE setID = %1) ORDER BY DATE ASC LIMIT 128").arg(_getDefaultTileSet());
    qint64 amount = (qint64)task->amount();
    QList<quint64> tlist;
    if(query.exec(s)) {
        while(query.next() && amount >= 0) {
            tlist << query.value(0).toULongLong();
            amount -= query.value(1).toULongLong();
            qCDebug(QGCTileCacheLog) << "_pruneCache() HASH:" << query.value(2).toString();
        }
        while(tlist.count()) {
            s = QString("DELETE FROM Tiles WHERE tileID = %1").arg(tlist[0]);
            tlist.removeFirst();
            if(!query.exec(s))
                break;
        }
        task->setPruned();
    }
}
开发者ID:420174953,项目名称:qgroundcontrol,代码行数:29,代码来源:QGCTileCacheWorker.cpp

示例9: update

void StatWidget::update() {
    NodeItem::m.lock();
    treeView->doItemsLayout();
    NodeItem::m.unlock();
    updateBoard();
    Ui_Statsui::depth->setText("Depth: " + QString::number(rb.depth));
    setWindowTitle(QString::fromStdString(rb.getInfo()).left(20) + QString::fromStdString(rb.getLine()));
    static QList<Stats> prev;
    prev.append(rb.getStats());
    if (prev.size() > 10)
        prev.removeFirst();

#define DISPLAYNUM(x) n##x->setText(number(prev.last().x)); if (prev.size() > 1) v##x->setText(number((prev.last().x - prev.first().x) / (prev.size()-1)));

    ninternalNode->setText(number(WorkThread::getRunning()));
//    vttentries->setText(stats.tt);
    DISPLAYNUM(node)
    DISPLAYNUM(eval)
    DISPLAYNUM(tthit)
    DISPLAYNUM(ttuse)
    DISPLAYNUM(ttalpha)
    DISPLAYNUM(ttbeta)
    DISPLAYNUM(ttoverwrite)
    DISPLAYNUM(ttinsufficient)
    DISPLAYNUM(ttstore)
    DISPLAYNUM(ttmerge)
    DISPLAYNUM(leafcut);
    DISPLAYNUM(pthit);
    DISPLAYNUM(ptmiss);
    DISPLAYNUM(ptuse);
    DISPLAYNUM(ptcollision);
    DISPLAYNUM(jobs);
    DISPLAYNUM(cancelJob); }
开发者ID:gpiez,项目名称:hayabusa,代码行数:33,代码来源:statwidget.cpp

示例10: apply_helper

void ChangeSet::apply_helper()
{
    // convert all ops to replace
    QList<EditOp> replaceList;
    {
        while (!m_operationList.isEmpty()) {
            const EditOp cmd(m_operationList.first());
            m_operationList.removeFirst();
            convertToReplace(cmd, &replaceList);
        }
    }

    // execute replaces
    if (m_cursor)
        m_cursor->beginEditBlock();

    while (!replaceList.isEmpty()) {
        const EditOp cmd(replaceList.first());
        replaceList.removeFirst();
        doReplace(cmd, &replaceList);
    }

    if (m_cursor)
        m_cursor->endEditBlock();
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:25,代码来源:changeset.cpp

示例11: CurveMinChanged

void MixerCurve::CurveMinChanged(double value)
{
    QList<double> points = m_curve->getCurve();
    points.removeFirst();
    points.push_front(value);
    setCurve(&points);
}
开发者ID:nongxiaoming,项目名称:QGroundStation,代码行数:7,代码来源:mixercurve.cpp

示例12: query

//-----------------------------------------------------------------------------
void
QGCCacheWorker::_pruneCache(QGCMapTask* mtask)
{
    if(!_testTask(mtask)) {
        return;
    }
    QGCPruneCacheTask* task = static_cast<QGCPruneCacheTask*>(mtask);
    QSqlQuery query(*_db);
    QString s;
    //-- Select tiles in default set only, sorted by oldest.
    s = QString("SELECT tileID, size, hash FROM Tiles WHERE tileID IN (SELECT A.tileID FROM SetTiles A join SetTiles B on A.tileID = B.tileID WHERE B.setID = %1 GROUP by A.tileID HAVING COUNT(A.tileID) = 1) ORDER BY DATE ASC LIMIT 128").arg(_getDefaultTileSet());
    qint64 amount = (qint64)task->amount();
    QList<quint64> tlist;
    if(query.exec(s)) {
        while(query.next() && amount >= 0) {
            tlist << query.value(0).toULongLong();
            amount -= query.value(1).toULongLong();
            qCDebug(QGCTileCacheLog) << "_pruneCache() HASH:" << query.value(2).toString();
        }
        while(tlist.count()) {
            s = QString("DELETE FROM Tiles WHERE tileID = %1").arg(tlist[0]);
            tlist.removeFirst();
            if(!query.exec(s))
                break;
        }
        task->setPruned();
    }
}
开发者ID:JcZou,项目名称:qgroundcontrol,代码行数:29,代码来源:QGCTileCacheWorker.cpp

示例13:

QList<Player*> MainWindow::shift(QList<Player*> l)
{
    QList<Player*> temp = l;
    Player* t = temp.first();
    temp.removeFirst();
    temp.push_back(t);
    return temp;
}
开发者ID:MayRiv,项目名称:MafiaHelper,代码行数:8,代码来源:mainwindow.cpp

示例14: setCertificate

bool SslServer::setCertificate(const QString &path)
{
    _isCertValid = false;

    if (path.isEmpty())
        return false;

    QFile certFile(path);
    if (!certFile.exists()) {
        quWarning() << "SslServer: Certificate file" << qPrintable(path) << "does not exist";
        return false;
    }

    if (!certFile.open(QIODevice::ReadOnly)) {
        quWarning()
        << "SslServer: Failed to open certificate file" << qPrintable(path)
        << "error:" << certFile.error();
        return false;
    }

    QList<QSslCertificate> certList = QSslCertificate::fromDevice(&certFile);

    if (certList.isEmpty()) {
        quWarning() << "SslServer: Certificate file doesn't contain a certificate";
        return false;
    }

    _cert = certList[0];
    certList.removeFirst(); // remove server cert

    // store CA and intermediates certs
    _ca = certList;

    if (!certFile.reset()) {
        quWarning() << "SslServer: IO error reading certificate file";
        return false;
    }

    _key = QSslKey(&certFile, QSsl::Rsa);
    certFile.close();

    if (_cert.isNull()) {
        quWarning() << "SslServer:" << qPrintable(path) << "contains no certificate data";
        return false;
    }
    if (!_cert.isValid()) {
        quWarning() << "SslServer: Invalid certificate (most likely expired)";
        // We allow the core to offer SSL anyway, so no "return false" here. Client will warn about the cert being invalid.
    }
    if (_key.isNull()) {
        quWarning() << "SslServer:" << qPrintable(path) << "contains no key data";
        return false;
    }

    _isCertValid = true;

    return _isCertValid;
}
开发者ID:2kah,项目名称:quassel,代码行数:58,代码来源:sslserver.cpp

示例15: mouseReleaseEvent

void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
    if (line != 0 && myMode == InsertLine)
    {
        QList<QGraphicsItem *> firstItems = items(line->line().p1());
        if (firstItems.count() && firstItems.first() == line)
            firstItems.removeFirst();
        QList<QGraphicsItem *> secondItems = items(line->line().p2());
        if (secondItems.count() && secondItems.first() == line)
            secondItems.removeFirst();

        removeItem(line);
        delete line;

        if (firstItems.count() > 0 && secondItems.count() > 0 &&
            firstItems.first()->type() == DiagramItem::Type &&
            secondItems.first()->type() == DiagramItem::Type &&
            firstItems.first() != secondItems.first()) {
            DiagramItem *firstItem = qgraphicsitem_cast<DiagramItem *>(firstItems.first());
            DiagramItem *secondItem = qgraphicsitem_cast<DiagramItem *>(secondItems.first());

            if (firstItem->CheckEmployment())
            {
                line = 0;
                return;
            }
            if (secondItem->CheckEmployment())
            {
                line = 0;
                return;
            }

            Link *link = new Link(firstItem, secondItem);
            firstItem->addLink(link);
            secondItem->addLink(link);
            link->setZValue(-1000.0);
            addItem(link);
            link->updatePosition();
            emit linkInserted(firstItem, secondItem, link);
        }
        myMode = MoveItem;
    }
    line = 0;
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
开发者ID:who-is-here,项目名称:FreeCiscoSimulator,代码行数:45,代码来源:diagramscene.cpp


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