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


C++ QVector::pop_back方法代码示例

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


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

示例1: SearchSequence

void Private::SearchSequence(
    SeqIter					seq_cur,
    SeqIter					seq_end,
    ExpIter					exp_cur,
    ExpIter					exp_end,
    IdSetTable	const &		set_table,
    QVector<QModelIndex> &  path,
    QIdxSequence &          rv)
{   // TODO: optimized by dynamic programming.
    if (exp_cur == exp_end) {
        rv.push_back(path);
        return;
    }

    if (seq_cur == seq_end)
        return;

    SeqIter seq_nxt		= std::next(seq_cur);
    ExpIter exp_nxt		= std::next(exp_cur);
    auto & caller_set	= set_table[exp_cur->first];
    auto & callee_set	= set_table[exp_cur->second];
    auto & caller       = *seq_cur->first;
    auto & callee       = *seq_cur->second;

    if (caller_set.find(caller.id) != caller_set.end() &&
            callee_set.find(callee.id) != callee_set.end()) {
        path.push_back(caller.item->index());
        path.push_back(callee.item->index());
        SearchSequence(seq_nxt, seq_end, exp_nxt, exp_end, set_table, path, rv);
        path.pop_back();
        path.pop_back();
    }

    SearchSequence(seq_nxt, seq_end, exp_cur, exp_end, set_table, path, rv);
}
开发者ID:wiryls,项目名称:HomeworkCollectionOfMYLS,代码行数:35,代码来源:DataManager.cpp

示例2: DrawTrace

void LivewireCalculator::DrawTrace(uint x, uint y, QPainter &g) const
{
	const uint w = this->_weights->GetReducedWidth(), scale = this->_weights->GetScale(), s2 = scale / 2;
	if (this->_visited.Get(x /= scale, y /= scale)) // The endpoint has been solved, so we can actually draw the livewire
	{
		// Get every point from end to start by looping through the trace data
		QVector<QPoint> pts;
		uint I = x + y * w;
		do
		{
			QPoint p = QPoint((x = I % w) * scale + s2, (y = I / w) * scale + s2);
			pts.push_back(p);
			pts.push_back(p);
		}
		while ((I = this->_trace.Get(x, y)) != UINT_MAX);

		// Draw the points
		if (pts.size() >= 4)
		{
			pts.pop_back();
			pts.pop_front();
			g.drawLines(pts);
		}
	}
}
开发者ID:slash-segmentation,项目名称:livewire,代码行数:25,代码来源:LivewireCalculator.cpp

示例3: Optim

void fonctionsCommunes::Optim(QVector<Triangle> &triangles, QVector<QPointF> &points, QVector<QPoint> &pile)
{


    while (!pile.isEmpty()){
        QPoint f = pile[pile.size()-1] ;
        int x = f.x() ;
        int y = f.y() ;
        qDebug() << "pile " << x << y ;
        pile.pop_back();
        int idNonCommun = triangles[y].nonCommun(x) ; //chercher l'indice du point de f.y non commun avec f.x
        qDebug() << idNonCommun << ": idNonCommun";
        if ( (idNonCommun>0) && ((triangles[x].trouverVoisinSachantId(y)) >= 0 ) && ((triangles[y].trouverVoisinSachantId(x))>=0) )   {
            qDebug( ) << "swaping " << f.x() << f.y() ;

            if (triangles[x].inCircle( idNonCommun , points )){
                fonctionsCommunes::Swap(f.x() , f.y(), points ,triangles , pile ) ;
            }

        }

    }


}
开发者ID:khalilBF,项目名称:Incremental-Delaunay,代码行数:25,代码来源:fonctions.cpp

示例4:

QVector< int > Logger::polygonEndpointsTracklog()
{
	QVector<int> endpoints;
	bool append = false;
	int invalidElements = 0;
	for (int i = 0; i < m_gpsInfoBuffer.size(); i++)
	{
		if( !m_gpsInfoBuffer.at(i).position.IsValid() )
		{
			invalidElements++;
			append = true;
			continue;
		}
		if (append == true || endpoints.size() == 0)
		{
			endpoints.append(i+1-invalidElements);
			append = false;
			continue;
		}
		endpoints.pop_back();
		endpoints.append(i+1-invalidElements);
	}

	return endpoints;
}
开发者ID:Pent00,项目名称:Assisted-Nav,代码行数:25,代码来源:logger.cpp

示例5: writePair

void GwfStreamWriter::writePair(SCgObject *obj)
{
    QString type = mTypeAlias2GWFType[obj->typeAlias()].mid(0,3);
    if(type=="arc")
        writeStartElement(type);
    else
        writeStartElement("pair");
    writeObjectAttributes(obj);
    SCgPair* pair = static_cast<SCgPair*>(obj);
    SCgObject* b = pair->getBeginObject();
    SCgObject* e = pair->getEndObject();
    writeAttribute("id_b", QString::number(b->id()));
    writeAttribute("id_e", QString::number(e->id()));

    writePosition(b,"b_x","b_y");
    writePosition(e,"e_x","e_y");

    writeAttribute("dotBBalance", QString::number(pair->getBeginDot()));
    writeAttribute("dotEBalance", QString::number(pair->getEndDot()));
    QVector<QPointF> points = pair->scenePoints();
    points.pop_back();
    points.pop_front();
    writePoints(points);
    writeEndElement();
}
开发者ID:SadTigger,项目名称:kbe,代码行数:25,代码来源:gwfstreamwriter.cpp

示例6: run

 void run() {
     AVThread *avt = demux_thread->videoThread();
     avt->packetQueue()->clear(); // clear here
     if (pts <= 0) {
         demux_thread->demuxer->seek(qint64(-pts*1000.0) - 500LL);
         QVector<qreal> ts;
         qreal t = -1.0;
         while (t < -pts) {
             demux_thread->demuxer->readFrame();
             if (demux_thread->demuxer->stream() != demux_thread->demuxer->videoStream())
                 continue;
             t = demux_thread->demuxer->packet().pts;
             ts.push_back(t);
         }
         const qreal t0 = ts.back();
         ts.pop_back();
         const qreal dt = t0 - ts.back();
         pts = ts.back();
         // FIXME: sometimes can not seek to the previous pts, the result pts is always current pts, so let the target pts a little earlier
         pts -= dt/2.0;
     }
     qDebug("step backward: %lld, %f", qint64(pts*1000.0), pts);
     demux_thread->video_thread->setDropFrameOnSeek(false);
     demux_thread->seekInternal(qint64(pts*1000.0), AccurateSeek);
 }
开发者ID:fmoyaarnao,项目名称:QtAV,代码行数:25,代码来源:AVDemuxThread.cpp

示例7: pointsFromData

/** Returns a list of points on the bandwidth graph based on the supplied set
 * of rsdht or alldht values. */
void RSGraphWidget::pointsFromData(const std::vector<QPointF>& values,QVector<QPointF>& points)
{
    points.clear();

    int x = _rec.width();
    int y = _rec.height();

    float time_step = 1.0f ;	// number of seconds per pixel

    /* Translate all data points to points on the graph frame */

    // take 0 as the origin, otherwise the different curves are not aligned properly
    float last = 0;//values.back().x();

    //std::cerr << "Got " << values.size() << " values for index 0" << std::endl;

    float last_px = SCALE_WIDTH ;
    float last_py = 0.0f ;

    for (uint i = 0; i < values.size(); ++i)
	 {
		 //std::cerr << "Value: (" << values[i].x() << " , " << values[i].y() << ")" << std::endl;

		 // compute point in pixels

		 qreal px = x - (values[i].x()-last)*_time_scale ;
		 qreal py = y -  valueToPixels(values[i].y()) ;

		 if(px >= SCALE_WIDTH && last_px < SCALE_WIDTH)
		 {
			 float alpha = (SCALE_WIDTH - last_px)/(px - last_px) ;
			 float ipx = SCALE_WIDTH ;
			 float ipy = (1-alpha)*last_py + alpha*py ;

			 points << QPointF(ipx,y) ;
			 points << QPointF(ipx,ipy) ;
		 }
		 else if(i==0)
			 points << QPointF(px,y) ;

		 last_px = px ;
		 last_py = py ;

		 if(px < SCALE_WIDTH)
			 continue ;

		 _maxValue = std::max(_maxValue,values[i].y()) ;

		 // remove midle point when 3 consecutive points have the same value.

		 if(points.size() > 1 && points[points.size()-2].y() == points.back().y() && points.back().y() == py)
			 points.pop_back() ;

		 points << QPointF(px,py) ;

		 if(i==values.size()-1)
			 points << QPointF(px,y) ;
	 }
}
开发者ID:WAR10CKfreeworld,项目名称:RetroShare,代码行数:61,代码来源:RSGraphWidget.cpp

示例8: waypointsChanged

void PaintWidget::waypointsChanged()
{
	m_request.target = RoutingLogic::instance()->target();
	QVector< UnsignedCoordinate > waypoints = RoutingLogic::instance()->waypoints();
	if ( waypoints.size() > 0 && RoutingLogic::instance()->target() == waypoints.back() )
		waypoints.pop_back();
	m_request.waypoints = waypoints;
	update();
}
开发者ID:Karry,项目名称:monavsailfish,代码行数:9,代码来源:paintwidget.cpp

示例9: confint

QPair<T, T> confint(const QVector<T> &vecin) {
	long double avg = 0.0;
	long double stddev = 0.0;
	QVector<T> vec = vecin;
	qSort(vec.begin(), vec.end());
	for (int i=0;i<vec.count() / 20;++i) {
		vec.pop_front();
		vec.pop_back();
	}

	foreach(T v, vec)
		avg += v;
	avg /= vec.count();

	foreach(T v, vec)
		stddev += (v-avg)*(v-avg);
	stddev = sqrtl(stddev / vec.count());
	return QPair<T,T>(static_cast<T>(avg), static_cast<T>(1.96 * stddev));
}
开发者ID:Chasophias,项目名称:mumble,代码行数:19,代码来源:ResampMark.cpp

示例10: onMenuSelection

void ProfilesWindow::onMenuSelection(QAction *menuAction)
{
    QString id = menuAction->data().toString();

    QVector<int> checkedItems;
    for (int i = 0; i<ui->listWidgetProfiles->count(); i++){
        QListWidgetItem* item = ui->listWidgetProfiles->item(i);
        if (item->checkState()==Qt::Checked)
            checkedItems.push_back(item->data(Qt::UserRole).toInt());
    }

    if (id=="NEW_PROFILE"){
        m_DataManager->addNewProfile(tr("New Profile"));
        rebuild();
        return;
    }

    if (id=="CLONE_PROFILE"){
        if (checkedItems.size()!=1){
            QMessageBox::critical(this,tr("Incorrect arguments"),tr("Please select one and only one profile for cloning"),QMessageBox::Ok);
            return;
        }
        int index = checkedItems[0];
        m_DataManager->addNewProfile(m_DataManager->profiles(index)->name+" "+tr("copy"),index);
        rebuild();
        return;
    }

    if (id=="MERGE_PROFILES"){
        if (checkedItems.size()<2){
            QMessageBox::critical(this,tr("Incorrect arguments"),tr("Please select at least two profiles for merging"),QMessageBox::Ok);
            return;
        }
        if (QMessageBox::warning(this,tr("Data will be lost"),tr("Warning! After the merging uniqe difference between profiles will be lost. This operation can't be undone. Proceed?"),QMessageBox::Yes,QMessageBox::Cancel)==QMessageBox::Yes){
            while (checkedItems.size()>1){
                m_DataManager->mergeProfiles(checkedItems[checkedItems.size()-2],checkedItems[checkedItems.size()-1]);
                checkedItems.pop_back();
            }
            rebuild();
        }
        return;
    }
}
开发者ID:Allexin,项目名称:TrackYourTime,代码行数:43,代码来源:profileswindow.cpp

示例11: writeBus

void GwfStreamWriter::writeBus(SCgObject *obj)
{
    writeStartElement("bus");
    writeObjectAttributes(obj);
    SCgBus* bus = static_cast<SCgBus*>(obj);

    writeAttribute("owner", QString::number(bus->owner()->id()));

    QVector<QPointF> points = bus->scenePoints();
    writeAttribute("b_x", QString::number(points.first().x()));
    writeAttribute("b_y", QString::number(points.first().y()));
    writeAttribute("e_x", QString::number(points.last().x()));
    writeAttribute("e_y", QString::number(points.last().y()));

    // do not save begin and end points
    points.pop_back();
    points.pop_front();
    writePoints(points);

    writeEndElement();
}
开发者ID:SadTigger,项目名称:kbe,代码行数:21,代码来源:gwfstreamwriter.cpp

示例12: parseIfLikeDirective

//# if constant-expression newline group[opt]
bool Preprocessor::parseIfLikeDirective(IfLikeDirective *node)
{
    //cout << "parse if-like directive" << endl;
    Q_ASSERT(node->toItemComposite());
    TokenSection tokenSection = readLine();
    QVector<int> cleanedSection = cleanTokenRange(tokenSection);
    if(cleanedSection.count() < 3)
        return false;

    cleanedSection.erase(cleanedSection.begin(), cleanedSection.begin() + 2); //remove # and if
    cleanedSection.pop_back(); //remove endl;

    const TokenList sectionList(m_tokenContainer, cleanedSection);
    ExpressionBuilder expressionBuilder(sectionList, m_tokenTypeList, m_memoryPool);
    Expression *expr = expressionBuilder.parse();
    node->setTokenSection(tokenSection);
    node->setExpression(expr);

    parseGroup(node);
    return true;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:22,代码来源:rpp.cpp

示例13: builtRep

void Tree::builtRep(Node * SubTree , QVector<bool> Rep )
{
    //SubTree->ShowNode();
    if( SubTree->isLeaf() )
    {
        Code.insert( SubTree->getChar(), Rep );
        if(SubTree->getChar() == '*' )
            this->Represent += "!*";
        else if( SubTree->getChar() == '!' )
            this->Represent += "!!";
        else
            this->Represent += SubTree->getChar();
    }
    else
    {
        this->Represent += "*";
        Rep.push_back(0);
        builtRep(SubTree->getNodeLeft(),  Rep);
        Rep.pop_back();
        Rep.push_back(1);
        builtRep(SubTree->getNodeRight(),Rep );
    }
}
开发者ID:AlfredLima,项目名称:Huffman,代码行数:23,代码来源:tree.cpp

示例14: updateMapChannels


//.........这里部分代码省略.........
            // Collect all dimmers that affect current head:
            // They are the master dimmer (affects whole fixture)
            // and per-head dimmer.
            //
            // If there are no RGB or CMY channels, the least important* dimmer channel
            // is used to create grayscale image.
            //
            // The rest of the dimmer channels are set to full if dimmer control is
            // enabled and target color is > 0 (see
            // http://www.qlcplus.org/forum/viewtopic.php?f=29&t=11090)
            //
            // Note: If there is only one head, and only one dimmer channel,
            // make it a master dimmer in fixture definition.
            //
            // *least important - per head dimmer if present,
            // otherwise per fixture dimmer if present
            QVector <quint32> dim;
            if (masterDim != QLCChannel::invalid())
                dim << masterDim;

            if (headDim != QLCChannel::invalid())
                dim << headDim;

            uint col = map[y][x];

            if (rgb.size() == 3)
            {
                // RGB color mixing
                {
                    FadeChannel fc(doc(), grpHead.fxi, rgb.at(0));
                    fc.setTarget(qRed(col));
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }

                {
                    FadeChannel fc(doc(), grpHead.fxi, rgb.at(1));
                    fc.setTarget(qGreen(col));
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }

                {
                    FadeChannel fc(doc(), grpHead.fxi, rgb.at(2));
                    fc.setTarget(qBlue(col));
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }
            }
            else if (cmy.size() == 3)
            {
                // CMY color mixing
                QColor cmyCol(col);

                {
                    FadeChannel fc(doc(), grpHead.fxi, cmy.at(0));
                    fc.setTarget(cmyCol.cyan());
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }

                {
                    FadeChannel fc(doc(), grpHead.fxi, cmy.at(1));
                    fc.setTarget(cmyCol.magenta());
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }

                {
                    FadeChannel fc(doc(), grpHead.fxi, cmy.at(2));
                    fc.setTarget(cmyCol.yellow());
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }
            }
            else if (!dim.empty())
            {
                // Set dimmer to value of the color (e.g. for PARs)
                FadeChannel fc(doc(), grpHead.fxi, dim.last());
                // the weights are taken from
                // https://en.wikipedia.org/wiki/YUV#SDTV_with_BT.601
                fc.setTarget(0.299 * qRed(col) + 0.587 * qGreen(col) + 0.114 * qBlue(col));
                insertStartValues(fc, fadeTime);
                m_fader->add(fc);
                dim.pop_back();
            }

            if (m_dimmerControl)
            {
                // Set the rest of the dimmer channels to full on
                foreach(quint32 ch, dim)
                {
                    FadeChannel fc(doc(), grpHead.fxi, ch);
                    fc.setTarget(col == 0 ? 0 : 255);
                    insertStartValues(fc, fadeTime);
                    m_fader->add(fc);
                }
            }
        }
    }
开发者ID:janosvitok,项目名称:qlcplus,代码行数:101,代码来源:rgbmatrix.cpp

示例15: mousePressEvent

void SCgModeBus::mousePressEvent (QGraphicsSceneMouseEvent * mouseEvent , bool afterSceneEvent)
{
    if(afterSceneEvent)
    {
        if(mDecoratedMode)
            mDecoratedMode->mousePressEvent(mouseEvent, afterSceneEvent);
        return;
    }

    mouseEvent->accept();
    QPointF mousePos = mouseEvent->scenePos();

    if (mPathItem && mouseEvent->button() == Qt::LeftButton)
        mPathItem->pushPoint(mousePos);

    // right button
    if (mouseEvent->button() == Qt::RightButton)
    {
        if (mPathItem)
        {
            mPathItem->popPoint();
            // if there is no points
            if (mPathItem->points().empty())
                delete mPathItem;
            return;
        }
    }

    if (mouseEvent->button() == Qt::LeftButton)
    {
        if (!mPathItem)
        {
            SCgVisualObject *obj = scene()->scgVisualObjectAt(mousePos);
            mNode = (obj != 0 && obj->type() == SCgVisualObject::SCgNodeType) ? static_cast<SCgVisualNode*>(obj) : 0;
            if(mNode)
            {
                mPathItem = new SCgPathItem(scene());
                mPathItem->pushPoint(mNode->scenePos());

                QPen pen;

                pen.setColor(Qt::blue);
                pen.setWidthF(5.f);
                pen.setCapStyle(Qt::RoundCap);
                pen.setStyle(Qt::DashDotLine);

                mPathItem->setPen(pen);
                return;
            }

        }else
        {
            QVector<QPointF> points = mPathItem->points();
            // The last point in points is mousePos, so we should get previous
            QVector2D vec(points.at(points.size() - 2) - mousePos);

            Q_ASSERT(mNode && mNode->baseObject() && mNode->baseObject()->type() == SCgObject::Node);
            if (points.size() > 2 && vec.length() < 5.f)
            {
                points.pop_back();

//                SCgVisualContour* contour = 0;
                // get parent contour
//                QGraphicsItem* parent = mNode->parentItem();

//                if (parent && parent->type() == SCgVisualContour::Type)
//                    contour = static_cast<SCgVisualContour*>(parent);

                scene()->pushCommand(new SCgCommandCreateBus(scene(), static_cast<SCgNode*>(mNode->baseObject()),
                                                                   points, 0));
                delete mPathItem;

                return;
            }
        }
    }

    if(mDecoratedMode)
    {
        mDecoratedMode->mousePressEvent(mouseEvent, afterSceneEvent);
        mPassMouseReleaseEvent = true;
    }
}
开发者ID:mcdir,项目名称:sui,代码行数:83,代码来源:scgmodebus.cpp


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