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


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

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


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

示例1: 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

示例2: while

QVector<int> WireCreator::traceBackDE(int point)
{
    QVector<int> path;
    int lastPoint=-1;
    int currPoint=point;
    int nextPoint=point;
    while(forks.indexOf(currPoint)==-1|| path.length()==0){
        currPoint=nextPoint;
        for(auto edge: edges){
            if(currPoint==edge.first&&edge.second!=lastPoint){
                lastPoint=currPoint;
                nextPoint=edge.second;
                break;
            }
            if(currPoint==edge.second&&edge.first!=lastPoint){
                lastPoint=currPoint;
                nextPoint=edge.first;
                break;
            }
        }
    path.push_back(currPoint);
    }
    path.pop_front();
    return path;
}
开发者ID:akuchinke,项目名称:wire_bender,代码行数:25,代码来源:wirecreator.cpp

示例3: createStateFromLine

// 获取下一时刻所有目标的状态
std::vector<State> TargetDataReader::getNextStates()
{
    std::vector<State> re;
    QVector<QString> *dv;
    QString line;
    if (allDataVector.at(0)->size() > 0) {
//        QString line = dataVector.front();
//        State s = createStateFromLine(line);
//        if (re.size() == 0) {
//            re.push_back(s);
//            dataVector.pop_front();
//        } else {
//            State preState = re.back();
//            if (preState.getTime() == s.getTime()) {
//                re.push_back(s);
//                dataVector.pop_front();
//            }
//        }
        for(int i = 0; i < allDataVector.size();i++)
        {
            dv = allDataVector[i];
            if(dv->size() > 0){
                line = dv->front();
                State s = createStateFromLine(line);
                re.push_back(s);
                dv->pop_front();
            }
        }
    }
    return re;
}
开发者ID:kernelhcy,项目名称:targettracking,代码行数:32,代码来源:targetgenerator.cpp

示例4: render

void Scene::render()
{
    for(int i = -CWIDTH / 2; i < CWIDTH / 2; i ++)
    {
        qDebug() << i;
        for(int j = -CHEIGHT / 2; j < CHEIGHT / 2; j ++)
        {
            QVector<Ray*> rSeq = camera->pixelLight(i, j);
            int s = rSeq.size();
            Intensity rgb(0, 0, 0);
            while(!rSeq.empty())
            {
                Ray* tmp = rSeq.front();

                rgb = rgb + (1.0 / s) * getIntensity(tmp);
                rSeq.pop_front();
                if(tmp != NULL)
                {
                    delete tmp;
                    tmp = NULL;
                }
            }
            pixels[i + CWIDTH / 2][j + CHEIGHT / 2] = rgb.toRGB();

        }

    }
}
开发者ID:pertoX4726,项目名称:RayTracing,代码行数:28,代码来源:scene.cpp

示例5: 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

示例6: paintEvent

void CPUWidget::paintEvent(QPaintEvent *){
    QPainter p(this);
    //p.drawLine(0,0,450,100);
    //Qt::SolidLine,Qt::DashLine,Qt::DotLine,Qt::DashDotLine,Qt::DashDotDotLine
    QPen pen = p.pen();
    pen.setColor(Qt::black);
    pen.setWidth(2);
    p.setPen(pen);
    p.drawRect(0,0,450,100);
    pen.setWidth(1);
    pen.setStyle(Qt::DotLine);
    p.setPen(pen);
    p.drawLine(0,25,450,25);
    p.drawLine(0,50,450,50);
    p.drawLine(0,75,450,75);
    pen.setStyle(Qt::SolidLine);
    pen.setColor(Qt::red);
    pen.setWidth(2);
    p.setPen(pen);
    while (vcpu.size()>46) vcpu.pop_front();
    int cx = 45;
    for (int i=vcpu.size()-1;i>0;i--){
        p.drawLine(cx*10,100-(int)(vcpu[i]*100),cx*10-10,100-(int)(vcpu[i-1]*100));
        cx--;
    }

}
开发者ID:homelesser,项目名称:Task-Manager,代码行数:27,代码来源:cpuwidget.cpp

示例7: download

void FileUploader::download(const QString &rootPath, const QVector<mtp::ObjectId> &objectIds)
{
	_model->moveToThread(&_workerThread);
	_total = 0;

	mtp::ObjectId currentParentId = _model->parentObjectId();

	QVector<QPair<QString, mtp::ObjectId> > input;
	for(auto id : objectIds)
		input.push_back(qMakePair(rootPath, id));

	QVector<QPair<QString, mtp::ObjectId> > files;
	while(!input.empty())
	{
		QString prefix = input.front().first;
		mtp::ObjectId id = input.front().second;
		input.pop_front();

		MtpObjectsModel::ObjectInfo oi = _model->getInfoById(id);
		if (oi.Format == mtp::ObjectFormat::Association)
		{
			//enumerate here
			QString dirPath = prefix + "/" + oi.Filename;
			mtp::SessionPtr session = _model->session();
			mtp::msg::ObjectHandles handles = session->GetObjectHandles(mtp::Session::AllStorages, mtp::ObjectFormat::Any, id);
			qDebug() << "found " << handles.ObjectHandles.size() << " objects in " << dirPath;
			for(mtp::ObjectId id : handles.ObjectHandles)
				input.push_back(qMakePair(dirPath, id));
		}
		else
		{
			_total += oi.Size;
			files.push_back(qMakePair(prefix + "/" + oi.Filename, id));
		}
	}

	qDebug() << "downloading " << files.size() << " file(s), " << _total << " bytes";
	_startedAt = QDateTime::currentDateTime();
	_aborted = false;
	if (_total < 1)
		_total = 1;

	for(const auto & file : files)
	{
		if (_aborted)
			break;
		emit executeCommand(new DownloadFile(file.first, file.second));
	}
	emit executeCommand(new FinishQueue(currentParentId));
}
开发者ID:dsimakov,项目名称:android-file-transfer-linux,代码行数:50,代码来源:fileuploader.cpp

示例8: getSourceRay

float Scene::getSourceRay(int i, Point* p)
{
    Point* oi1 = sources.at(i)->getOrigin();
    Ray sourceRay(*oi1, *p - *oi1, 0);
    float f1 = distance(oi1, p);
    int s1 = models.size();
    int k1 = 0;
    for(k1 = 0; k1 < s1; k1 ++)
    {
        float s = models.at(k1)->intersection(sourceRay);
        if((s > THRE * 10) && (f1 - s > THRE * 10)) break;
    }
    if(k1 == s1) return 1;

    int cnt = 0;
    QVector<Point *> org = sources.at(i)->sampleOrigin();
    int size = org.size();
    for(int j = 0; j < size; j ++)
    {
        Point* oi = org.at(j);
        Point op = *p - *oi;
        Ray sourceRay(*oi, op, 0);
        float f = distance(oi, p);
        int s = models.size();
        int k = 0;
        for(k = 0; k < s; k ++)
        {
            float s = models.at(k)->intersection(sourceRay);
            if((s > THRE * 10) && (f - s > THRE * 10)) break;
        }
        if(k == s) cnt ++;
    }
    while(!org.empty())
    {
        Point* first = org.front();
        if(first != NULL)
        {
            delete first;
            first = NULL;
        }
        org.pop_front();
    }
    return qMin(2 * cnt / (size + 0.0), 1.0);
}
开发者ID:pertoX4726,项目名称:RayTracing,代码行数:44,代码来源:scene.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: UpdateComputedWidths

	void SeparateTabBar::UpdateComputedWidths () const
	{
		const auto cnt = count ();
		ComputedWidths_.resize (cnt);

		const auto maxTabWidth = width () / 4;

		struct TabInfo
		{
			int Idx_;
			int WidthHint_;
		};
		QVector<TabInfo> infos;
		for (int i = 0; i < cnt - 1; ++i)
			infos.push_back ({ i, std::min (QTabBar::tabSizeHint (i).width (), maxTabWidth) });
		std::sort (infos.begin (), infos.end (),
				[] (const TabInfo& l, const TabInfo& r) { return l.WidthHint_ < r.WidthHint_; });

		const auto hspace = std::max (style ()->pixelMetric (QStyle::PM_TabBarTabHSpace), 10);
		const auto btnWidth = AddTabButton_ ? AddTabButton_->sizeHint ().width () + hspace : 30;

		auto remainder = width () - btnWidth;

		while (!infos.isEmpty ())
		{
			auto currentMax = remainder / infos.size ();
			if (infos.front ().WidthHint_ > currentMax)
				break;

			const auto& info = infos.front ();
			remainder -= info.WidthHint_;
			ComputedWidths_ [info.Idx_] = info.WidthHint_;
			infos.pop_front ();
		}

		if (infos.isEmpty ())
			return;

		const auto uniform = remainder / infos.size ();
		for (const auto& info : infos)
			ComputedWidths_ [info.Idx_] = uniform;
	}
开发者ID:eringus,项目名称:leechcraft,代码行数:42,代码来源:separatetabbar.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: getWaveData

void QFilterData::getWaveData(const QString &strFileName, QVector<float> &leftArm,
							  QVector<float> &leftAnkle,
							  QVector<float> &rightArm,
							  QVector<float> &rightAnkle, QVector<int> &arrMapValue, int &nLeftUT, int &nRightUT)
{
	QVector<int> vectOriginal[4];

	// 第一步:读取文件
	QFile file(strFileName);

	if(!file.exists())
	{
		return;
	}

	QVector<int> arrPressure;
	if(file.open(QFile::ReadOnly | QFile::Text))
	{
		QTextStream in(&file);
		while(!in.atEnd())
		{
			QStringList strValue = in.readLine().remove("\r\n").split("; ");

			if(strValue.size() < 4)
			{
				continue;
			}
			int nLeftAnkle = strValue.at(0).toInt();
			int nRightAnkle = strValue.at(1).toInt();
			int nLeftArm = strValue.at(2).toInt();
			int nRightArm = strValue.at(3).toInt();

			if(arrPressure.size() >= 84000)
			{
				for(int i = 0; i<4; ++i)
				{
					arrPressure.pop_front();
				}
			}

			arrPressure.append(nRightArm);
			arrPressure.append(nLeftArm);
			arrPressure.append(nRightAnkle);
			arrPressure.append(nLeftAnkle);


			//QVector<float> arrFiltered =  _filterOrignal(arrTemp);
			//for(int i = 0; i<4; ++i)
			//{
			//	//qDebug()<<"index Filtered: "<<i<<"\t"<<vectOrignal.at(i+j*4);
			//	m_arrFiltedData[i].append(arrFiltered.at(i));
			//}

			//for(int i = 0; i<4; ++i)
			//{

			//	arrPressure[i].append(arrTemp.at(i));
			//}
		}
	}
	file.close();

	for(int i = 0; i<arrPressure.size(); i += 4)
	{
		qDebug()<<arrPressure.at(i)<<"\t"<<arrPressure.at(i+1)<<"\t"<<arrPressure.at(i+2)<<"\t"<<arrPressure.at(i+3);
	}
	QVector<float> vectFilter = _filterOrignal(arrPressure);
	for(int i = 0; i<vectFilter.size();i += 4)
	{
		qDebug()<<vectFilter.at(i)<<"\t"<<vectFilter.at(i+1)<<"\t"<<vectFilter.at(i+2)<<"\t"<<vectFilter.at(i+3);
	}

	//double dDest = 0.0f;
	//for(int i = 0; i<vectFilter.size();i += 4)
	//{
	//	ButterworthLowpassFilter0100SixthOrder(vectFilter.at(i), dDest);
	//	qDebug()<<vectFilter.at(i)<<"\t"<<dDest;
	//}
	_filterSecond(vectFilter);

	for(int i = 0; i<vectFilter.size();i += 4)
	{
		qDebug()<<vectFilter.at(i)<<"\t"<<vectFilter.at(i+1)<<"\t"<<vectFilter.at(i+2)<<"\t"<<vectFilter.at(i+3);
	}

	_saveFiltedPressure(vectFilter);
	//// 滤波处理
	for(int i = 0; i <4; ++i)
	{
		//m_arrFiltedData[i].append();
		//_filterSecond(m_arrFiltedData[i]);
		//// 丢掉前1000个点
		m_arrFiltedData[i].remove(0, 1000);
	}

	QVector<int> arrValley[4];
	_getValleyPeak(arrValley);

	//double dDest = 0.0;
	//for(int i = 0; i<m_arrFiltedData[0].size(); ++i)
//.........这里部分代码省略.........
开发者ID:takeshineshiro,项目名称:QT_arteriosclerosis,代码行数:101,代码来源:QFilterData.cpp


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