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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
	#ifdef Q_WS_X11
		XInitThreads();
	#endif

	Engine engine(argc, argv,"demo_game/media/");

	SceneGraph* sg = engine.getScenegraph_TEMPORARY();
	g_sg = sg;

	QList<InputManager::Control> controls;
	controls.push_back(InputManager::Control(false,"avance"));
	controls.push_back(InputManager::Control(false,"recule"));
	controls.push_back(InputManager::Control(false,"gauche"));
	controls.push_back(InputManager::Control(false,"droite"));
	INPUT_MANAGER.addControls(controls);

	INPUT_MANAGER.addBinding("KB_Z","avance");
	INPUT_MANAGER.addBinding("KB_Up","avance");
	INPUT_MANAGER.addBinding("KB_S","recule");
	INPUT_MANAGER.addBinding("KB_Down","recule");
	INPUT_MANAGER.addBinding("KB_Q","gauche");
	INPUT_MANAGER.addBinding("KB_Left","gauche");
	INPUT_MANAGER.addBinding("KB_D","droite");
	INPUT_MANAGER.addBinding("KB_Right","droite");

	Node* nRot = new Node("Rotating node");
	Node* nQt = new Node("Qt Logo");
	Node* nCam = new Node("Camera");
	Node* nCamFollow = new Node("Camera Follow");
	Node* nHead = new Node("Head");
	Node* nStar = new Node("Star");
	Node* nLight = new Node("Light");
	Node* nLight2 = new Node("Light2");
	Node* nUni = new Node("Unicorn");
	Node* nGarg = new Node("Gargoyle");
	Node* nDuck = new Node("Duck");
	Node* nBuddy = new Node("Buddy");
	Node* nSand = new Node("Sand");

	QVector<Node*> balls;
	QVector<Node*> walls;

	for(int i=0 ; i<4 ; i++) {
		walls.push_back(new Node("Wall" + QString().setNum(i+1)));
	}
	for(int i=0 ; i<15 ; i++) {
		balls.push_back(new Node("Ball" + QString().setNum(i+1)));
	}

	nRot->addProperty(new IProperty());
//	nRot->addProperty(new DummyUpdatable());
//	nQt->addProperty(new QtLogo(engine.getGLW_TEMPORARY()));
//	nQt->addProperty(new Grid(1.0f, 1.0f, 40, 40));
	//nDuckGrid->addProperty(new Grid(1.0f, 1.0f, 40, 40));
	nCam->addProperty(new Camera(70,1,200));
	nCamFollow->addProperty(new Camera(90,1,200));

	nHead->addProperty(new DummyUpdatable());
	Light* light;

	light = new Light(false);
	//light->setType(Light::SUN);
	//light->setDiffuseColor(Vector4f(0.2,1.0,0.2,1.0));
	//light->setSpecularColor(Vector4f(0.2,1.0,0.2,1.0));
	light->setDiffuseColor(Vector4f(1.0,1.0,0.0,1.0));
	light->setSpecularColor(Vector4f(1.0,1.0,1.0,1.0));
	nLight2->addProperty(light);

	light = new Light(true);
	//light->setType(Light::SPOT);
	light->setDiffuseColor(Vector4f(1.0,1.0,1.0,1.0));
	light->setSpecularColor(Vector4f(1.0,1.0,1.0,1.0));
	//light->setDiffuseColor(Vector4f(1.0,0.2,0.2,1.0));
	//light->setSpecularColor(Vector4f(1.0,0.2,0.2,1.0));
	nLight->addProperty(light);


	Mesh plane = MESH_MANAGER.get("Plane");
	Mesh cube = MESH_MANAGER.get("Cube");
	Mesh sphere = MESH_MANAGER.get("Sphere_16_32");
	Mesh mesh = MESH_MANAGER.get("duck");
	Mesh buddymesh = MESH_MANAGER.get("buddy");

	Material buddy = MATERIAL_MANAGER.get("buddy");
	Material duck = MATERIAL_MANAGER.get("duck");
	Material star = MATERIAL_MANAGER.get("star");
	Material gargoyle = MATERIAL_MANAGER.get("gargoyle");
	Material sand = MATERIAL_MANAGER.get("sand");

	Material gradientmats[4];
	gradientmats[0] = MATERIAL_MANAGER.get("grad1");
	gradientmats[1] = MATERIAL_MANAGER.get("grad2");
	gradientmats[2] = MATERIAL_MANAGER.get("grad3");
	gradientmats[3] = MATERIAL_MANAGER.get("grad4");

	Sample sample = SAMPLE_MANAGER.get("quacking.wav");

	nDuck->addProperty(new MeshRenderer(mesh,duck));
//.........这里部分代码省略.........
开发者ID:smatcher,项目名称:S5old,代码行数:101,代码来源:test_physics.cpp

示例2: onReportsTabChange

void MainWindow::onReportsTabChange()
{
    /*
    QMessageBox *msgBox = new QMessageBox();
    msgBox->setWindowTitle("I Worked!!");
    msgBox->setInformativeText("The Current index tab is "+ QString::number(ui->reportsTab->currentIndex()));
    msgBox->show();
    */

    switch(ui->reportsTab->currentIndex())
    {
        case 0:
        {
        QVector<QPointF> data;

        LinkedList<GolfObject>* r_list = this->p->getRounds(this->p->getId(), new Round());

        int count = 0;
        for(int i = r_list->getSize()-1; i > -1; i--)
        {

            int score = ((Round *)r_list->get(i))->getGross();
            QPointF point;
            point.setX(count);
            point.setY(score);
            data.push_back(point);
            count++;
        }

        /*
         * NOTE: 0 = gross scores
         */

        ui->plotter->setCurveData(0, data);
        break;
        }

        /***********************************************************************************************************************************
        * This loads the first tableview of rounds tab.
        * One reason for it not updating when a new round is added could be due to the code location here
        */
        case 1:
        {
            LinkedList<GolfObject>* r_List;
            if(!filterOn)
            {
                r_List = p->getRounds(p->getId(), new Round());
            }
            else
            {
                r_List = getRoundList();
            }

            ui->tableWidget->setRowCount(r_List->getSize());
            ui->tableWidget->setColumnCount(6);
            ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Date"));
            ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Time"));
            ui->tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Weather"));
            ui->tableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem("Gross"));
            ui->tableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem("Nett"));
            ui->tableWidget->setHorizontalHeaderItem(5, new QTableWidgetItem("Stableford"));

            for(int i = 0 ; i < r_List->getSize(); i++)
            {
                ui->tableWidget->setItem(i,0, new QTableWidgetItem(QString::fromStdString(((Round *)r_List->get(i))->getDate())));
                ui->tableWidget->setItem(i,1, new QTableWidgetItem(QString::fromStdString(((Round *)r_List->get(i))->getTime())));
                ui->tableWidget->setItem(i,2, new QTableWidgetItem(QString::fromStdString(((Round *)r_List->get(i))->getWeather())));
                ui->tableWidget->setItem(i,3, new QTableWidgetItem(QString::number(((Round *)r_List->get(i))->getGross())));
                ui->tableWidget->setItem(i,4, new QTableWidgetItem(QString::number(((Round *)r_List->get(i))->getNett())));
                ui->tableWidget->setItem(i,5, new QTableWidgetItem(QString::number(((Round *)r_List->get(i))->getPoints())));
            }

            QHeaderView* header = ui->tableWidget->horizontalHeader();
            header->setSectionResizeMode(QHeaderView::Stretch);

        break;
        }

    }
}
开发者ID:bennypotter,项目名称:statcaddy,代码行数:80,代码来源:mainwindow.cpp

示例3: handleMessage

void PropertySyncer::handleMessage(const GammaRay::Message& msg)
{
    Q_ASSERT(msg.address() == m_address);
    switch (msg.type()) {
    case Protocol::PropertySyncRequest:
    {
        Protocol::ObjectAddress addr;
        msg.payload() >> addr;
        Q_ASSERT(addr != Protocol::InvalidObjectAddress);

        const auto it = std::find_if(m_objects.constBegin(), m_objects.constEnd(), [addr](const ObjectInfo &info) {
            return info.addr == addr;
        });
        if (it == m_objects.constEnd())
            break;

        QVector<QPair<QString, QVariant> > values;
        const auto propCount = (*it).obj->metaObject()->propertyCount();
        values.reserve(propCount);
        for (int i = qobjectPropertyOffset(); i < propCount; ++i) {
            const auto prop = (*it).obj->metaObject()->property(i);
            values.push_back(qMakePair(QString(prop.name()), prop.read((*it).obj)));
        }
        Q_ASSERT(!values.isEmpty());

        Message msg(m_address, Protocol::PropertyValuesChanged);
        msg.payload() << addr << (quint32)values.size();
        foreach (const auto &value, values)
            msg.payload() << value.first << value.second;
        emit message(msg);
        break;
    }
    case Protocol::PropertyValuesChanged:
    {
        Protocol::ObjectAddress addr;
        quint32 changeSize;
        msg.payload() >> addr >> changeSize;
        Q_ASSERT(addr != Protocol::InvalidObjectAddress);
        Q_ASSERT(changeSize > 0);

        auto it = std::find_if(m_objects.begin(), m_objects.end(), [addr](const ObjectInfo &info) {
            return info.addr == addr;
        });
        if (it == m_objects.end())
            break;

        for (quint32 i = 0; i < changeSize; ++i) {
            QString propName;
            QVariant propValue;
            msg.payload() >> propName >> propValue;
            (*it).recursionLock = true;
            (*it).obj->setProperty(propName.toUtf8(), propValue);

            // it can be invalid if as a result of the above call new objects have been registered for example
            it = std::find_if(m_objects.begin(), m_objects.end(), [addr](const ObjectInfo &info) {
                return info.addr == addr;
            });
            Q_ASSERT(it != m_objects.end());
            (*it).recursionLock = false;
        }
        break;
    }
    default:
        Q_ASSERT(!"We should not get here!");
    }
}
开发者ID:ChristopherHahn,项目名称:GammaRay,代码行数:66,代码来源:propertysyncer.cpp

示例4: DisplayBDOverlay

void BDOverlayScreen::DisplayBDOverlay(BDOverlay *overlay)
{
    if (!overlay || !m_player)
        return;

    if (!overlay->m_data)
    {
        m_overlayArea = overlay->m_position;
        SetArea(MythRect(m_overlayArea));
        DeleteAllChildren();
        m_overlayMap.clear();
        SetRedraw();
        LOG(VB_PLAYBACK, LOG_INFO, LOC +
            QString("Initialised Size: %1x%2 (%3+%4) Plane: %5 Pts: %6")
                .arg(overlay->m_position.width())
                .arg(overlay->m_position.height())
                .arg(overlay->m_position.left())
                .arg(overlay->m_position.top())
                .arg(overlay->m_plane)
                .arg(overlay->m_pts));
        BDOverlay::DeleteOverlay(overlay);
        return;
    }

    if (!m_overlayArea.isValid())
    {
        LOG(VB_GENERAL, LOG_ERR, LOC +
            "Error: Overlay image submitted before initialisation.");
    }

    VideoOutput *vo = m_player->GetVideoOutput();
    if (!vo)
        return;

    QRect   rect = overlay->m_position;
    QString hash = QString("%1+%2+%3x%4")
                    .arg(rect.left()).arg(rect.top())
                    .arg(rect.width()).arg(rect.height());

    // remove if we already have this overlay
    if (m_overlayMap.contains(hash))
    {
        LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Removing %1 (%2 left)")
            .arg(hash).arg(m_overlayMap.size()));
        MythUIImage *old = m_overlayMap.take(hash);
        DeleteChild(old);
    }

    // convert the overlay palette to ARGB
    uint32_t *origpalette = (uint32_t *)(overlay->m_palette);
    QVector<unsigned int> palette;
    for (int i = 0; i < 256; i++)
    {
        int y  = (origpalette[i] >> 0) & 0xff;
        int cr = (origpalette[i] >> 8) & 0xff;
        int cb = (origpalette[i] >> 16) & 0xff;
        int a  = (origpalette[i] >> 24) & 0xff;
        int r  = int(y + 1.4022 * (cr - 128));
        int b  = int(y + 1.7710 * (cb - 128));
        int g  = int(1.7047 * y - (0.1952 * b) - (0.5647 * r));
        if (r < 0) r = 0;
        if (g < 0) g = 0;
        if (b < 0) b = 0;
        if (r > 0xff) r = 0xff;
        if (g > 0xff) g = 0xff;
        if (b > 0xff) b = 0xff;
        palette.push_back((a << 24) | (r << 16) | (g << 8) | b);
    }

    // convert the image to QImage
    QImage img(rect.size(), QImage::Format_Indexed8);
    memcpy(img.bits(), overlay->m_data, rect.width() * rect.height());
    img.setColorTable(palette);
    img.convertToFormat(QImage::Format_ARGB32);

    // add to screen
    QRect scaled = vo->GetImageRect(rect);
    if (scaled.size() != rect.size())
    {
        img = img.scaled(scaled.width(), scaled.height(),
                         Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    }

    MythPainter *osd_painter = vo->GetOSDPainter();
    MythImage* image = NULL;
    if (osd_painter)
         image = osd_painter->GetFormatImage();

    if (image)
    {
        image->Assign(img);
        MythUIImage *uiimage = new MythUIImage(this, "bdoverlay");
        if (uiimage)
        {
            uiimage->SetImage(image);
            uiimage->SetArea(MythRect(scaled));
            m_overlayMap.insert(hash, uiimage);
            LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Added %1 (%2 tot)")
                .arg(hash).arg(m_overlayMap.size()));
        }
//.........这里部分代码省略.........
开发者ID:StefanRoss,项目名称:mythtv,代码行数:101,代码来源:bdoverlayscreen.cpp

示例5: paintEvent

void CTimeline::paintEvent(QPaintEvent* event)
{
	const QRect rect = event->rect();

	int tablePosY = m_viewPos.y() / m_rowHeight - 1;
	if (tablePosY < 0)
		tablePosY = 0;

	int tablePosX = m_viewPos.x() / m_frameWidth - 1;
	if (tablePosX < 0)
		tablePosX = 0;

	m_painter.begin(this);

	m_painter.fillRect(rect, QColor(212, 208, 200));

	m_painter.setClipRect(rect);
	m_painter.setClipping(true);
	m_painter.translate(QPoint(0, -m_viewPos.y()));

	QVector<QLine> greyLines;
	QVector<QLine> blackLines;

	m_painter.setPen(Qt::black);
	m_painter.setFont(m_font);

	if (tablePosY == 0)
		m_painter.drawText(QRect(4, 0, m_leftWidth, m_rowHeight), "Frame");
	greyLines.push_back(QLine(0, m_rowHeight - 1, rect.right(), m_rowHeight - 1));
	greyLines.push_back(QLine(0, m_rowHeight, rect.right(), m_rowHeight));

	int i, j;
	for (i = tablePosY; i < m_rows.size(); i++)
	{
		const Row& row = m_rows[i];
		if (i == m_selection.y())
			m_painter.fillRect(QRect(0, (i + 1) * m_rowHeight, rect.right(), m_rowHeight), QColor(230, 230, 230));
		greyLines.push_back(QLine(rect.left(), (i + 2) * m_rowHeight, rect.right(), (i + 2) * m_rowHeight));
		m_painter.drawText(QRect(4, (i + 1) * m_rowHeight, m_leftWidth, m_rowHeight), row.name);
		if ((i + 2) * m_rowHeight >= rect.bottom() + m_viewPos.y())
			break;
	}

	if (m_frameCount != -1)
	{
		i = m_leftWidth + m_frameCount * m_frameWidth - m_viewPos.x() + 2;
		if (i < m_leftWidth)
			i = m_leftWidth;
		m_painter.fillRect(QRect(i, 0, i + rect.width() - m_leftWidth, rect.bottom() + m_viewPos.y() + 1), QColor(0, 0, 0, 30));
	}

	blackLines.push_back(QLine(m_leftWidth - 4, m_viewPos.y(), m_leftWidth - 4, rect.bottom() + m_viewPos.y()));
	blackLines.push_back(QLine(m_leftWidth - 1, m_viewPos.y(), m_leftWidth - 1, rect.bottom() + m_viewPos.y()));

	m_painter.setPen(QColor(170, 170, 170));
	m_painter.drawLines(greyLines);
	m_painter.setPen(Qt::black);
	m_painter.drawLines(blackLines);

	greyLines.clear();
	blackLines.clear();
	QVector<QLine> redLines;

	m_painter.setClipRect(QRect(m_leftWidth, m_viewPos.y(), rect.right() - m_leftWidth, m_viewPos.y() + rect.bottom()));
	m_painter.translate(QPoint(m_leftWidth - m_viewPos.x() + m_frameWidth / 2 + 1, 0));

	const int maxRight = m_viewPos.x() + rect.right() - m_leftWidth;
	int pos;
	for (i = tablePosX; i * m_frameWidth <= maxRight; i++)
	{
		pos = i * m_frameWidth;
		if (i % 5 == 0)
		{
			greyLines.push_back(QLine(pos, m_rowHeight + 1, pos, m_viewPos.y() + rect.bottom() + 1));
			blackLines.push_back(QLine(pos, 0, pos, m_rowHeight - 1));
			m_painter.drawText(QRect(pos + 2, -2, m_frameWidth * 2 - 1, m_rowHeight), QString::number(i));
		}
		else
			blackLines.push_back(QLine(pos, m_rowHeight - 5, pos, m_rowHeight - 1));
	}

	redLines.push_back(QLine(m_currentFrame * m_frameWidth, m_viewPos.y(), m_currentFrame * m_frameWidth, m_viewPos.y() + rect.bottom() + 1));
	redLines.push_back(QLine(m_currentFrame * m_frameWidth - 1, m_viewPos.y(), m_currentFrame * m_frameWidth - 1, m_viewPos.y() + rect.bottom() + 1));

	m_painter.setPen(QColor(170, 170, 170));
	m_painter.drawLines(greyLines);
	m_painter.setPen(Qt::black);
	m_painter.drawLines(blackLines);

	for (i = tablePosY; i < m_rows.size(); i++)
	{
		const Row& row = m_rows[i];
		if (row.keys.size() > 0)
		{
			m_painter.setBrush(row.color);
			for (j = 0; j < row.keys.size(); j++)
			{
				pos = row.keys[j] * m_frameWidth;
				if (pos >= m_viewPos.x() - m_frameWidth && pos <= maxRight)
				{
//.........这里部分代码省略.........
开发者ID:Aishiro,项目名称:ATools,代码行数:101,代码来源:Timeline.cpp

示例6: getTheSplitAsString

QString Splitter::getTheSplitAsString()const{
    QVector<QString> colors;
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#ff0033\">");
    colors.push_back("<font color=\"#aa5500\">");
    colors.push_back("<font color=\"#0000ff\">");
    colors.push_back("<font color=\"#00ff00\">");
    colors.push_back("<font color=\"#ff0000\">");
    colors.push_back("<font color=\"#ffff00\">");
    colors.push_back("<font color=\"#00ffff\">");
    colors.push_back("<font color=\"#ff00ff\">");
    colors.push_back("<font color=\"#880088\">");
    colors.push_back("<font color=\"#880000\">");
    colors.push_back("<font color=\"#008800\">");
    colors.push_back("<font color=\"#000088\">");
    colors.push_back("<font color=\"#888800\">");
    colors.push_back("<font color=\"#008888\">");
    colors.push_back("<font color=\"#5533ff\">");
    colors.push_back("<font color=\"#a2b64f\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    colors.push_back("<font color=\"#000000\">");
    std::cout << worlds.size();
    world buffer(worlds[0]);
    for(int x=0; x<buffer.getSizeX(); ++x){
        for(int y=0; y<buffer.getSizeY(); ++y){
            buffer.setValue(x,y,0);
        }
    }
    for(int i=1; i<worlds.size(); ++i){
        for(int x=0; x<buffer.getSizeX(); ++x){
            for(int y=0; y<buffer.getSizeY(); ++y){
                if(worlds[i].getValue(x,y) == 0) buffer.setValue(x,y,i);
            }
        }
    }
    std::stringstream str;
    str << "<html><body>" << std::endl;
    for(int x=0; x<buffer.getSizeX(); ++x){
        for(int y=0; y<buffer.getSizeY(); ++y){

            str << colors[buffer.getValue(x,y)%25].toStdString() << 0 << "</font>";
        }
        str << "<br>" << std::endl;
    }
    str << "</body></html>" << std::endl;

    return str.str().c_str();
}
开发者ID:Fettpet,项目名称:Hackerorg,代码行数:55,代码来源:splitter.cpp

示例7: toGif

bool Graphics::toGif(QImage& img, QString& path)
{
    int errcode;

    if(QFile(path).exists()) // Remove old file
        QFile::remove(path);

    GifFileType* t = EGifOpenFileName(path.toStdString().c_str(),true, &errcode);
    if(!t){
        EGifCloseFile(t, &errcode);
        std::cout << "Can't open\n";
        return false;
    }

    EGifSetGifVersion(t, true);

    GifColorType* colorArr = new GifColorType[256];
    ColorMapObject* cmo = GifMakeMapObject(256, colorArr);

    bool unfinished = false;
    QImage tarQImg(img.width(), img.height(), QImage::Format_Indexed8);
    QVector<QRgb> table;
    for(int y = 0; y < img.height(); y++){
        for(int x = 0; x < img.width(); x++){
            if(table.size() >= 256){
                unfinished = true;
                break;
            }
            QRgb pix;
            if(!table.contains(pix = img.pixel(x,y))){
                table.push_back(pix);
                tarQImg.setColor(tarQImg.colorCount(), pix);
            }
            tarQImg.setPixel(x,y,table.indexOf(pix));
        }
        if(table.size() >= 256){
            unfinished = true;
            break;
        }
    }

    if(unfinished){
        EGifCloseFile(t, &errcode);
        std::cout << "Unfinished\n";
        return false;
    }


    for(int l = tarQImg.colorCount(); l < 256; l++){
        tarQImg.setColor(l,0);
    }

    if(tarQImg.colorTable().size() != 256){
        EGifCloseFile(t, &errcode);
        std::cout << "A lot of colors\n";
        return false;
    }

    QVector<QRgb> clTab = tarQImg.colorTable();

    for(int i = 0; i < 255; i++){
        QRgb rgb = clTab[i];
        colorArr[i].Red = qRed(rgb);
        colorArr[i].Green = qGreen(rgb);
        colorArr[i].Blue = qBlue(rgb);
    }
    cmo->Colors = colorArr;

    errcode = EGifPutScreenDesc(t, img.width(), img.height(), 256, 0, cmo);
    if(errcode != GIF_OK){
        EGifCloseFile(t, &errcode);
        std::cout << "EGifPutScreenDesc error 1\n";
        return false;
    }

    errcode = EGifPutImageDesc(t, 0, 0, img.width(), img.height(), false, 0);
    if(errcode != GIF_OK){
        EGifCloseFile(t, &errcode);
        std::cout << "EGifPutImageDesc error 2\n";
        return false;
    }

    //gen byte array
    GifByteType* byteArr = tarQImg.bits();

    for(int h = 0; h < tarQImg.height(); h++){
        errcode = EGifPutLine(t, byteArr, tarQImg.width());
        if(errcode != GIF_OK){
            EGifCloseFile(t, &errcode);
            std::cout << "EGifPutLine error 3\n";
            return false;
        }

        byteArr += tarQImg.width();
        byteArr += ((tarQImg.width() % 4)!=0 ? 4 - (tarQImg.width() % 4) : 0);
    }

    if(errcode != GIF_OK){
        std::cout << "GIF error 4\n";
        return false;
//.........这里部分代码省略.........
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:101,代码来源:graphics.cpp

示例8: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QVector<Server> servers;

    //wczytanie konfiguracji
    QSettings settings("client.cfg", QSettings::IniFormat);
    settings.sync();

    int serversCount = settings.value("info/serversCount", 0).toInt();

    if(serversCount == 0)
    {
        //błąd, nie ma adresów
        std::cerr << "No known servers in configuration file" << std::endl;
        return 2;
    }

    for(int i=1; i<=serversCount; ++i)
    {
        Server server;
        server.name = settings.value("server"+QString::number(i)+"/name", "unknown server").toString();
        server.ip = QHostAddress(settings.value("server"+QString::number(i)+"/ip", "0.0.0.0").toString());
        server.port = settings.value("server"+QString::number(i)+"/port", "0").toInt();
        servers.push_back(server);
    }

    //połączenie i pobranie listy serwerów
    Client client;
    client.setServers(&servers);
    client.settings = &settings;

    //std::cout << "ACT?" << std::endl;
    if(client.send(QStringList() << "ACTIVE_SERVERS") == NO_SERVERS)
    {
        std::cout << "nie można się z niczym połączyć lub nikt nie akceptuje zapytań\n";
        exit(10);
    }
    client.socket.waitForReadyRead(15000);

    /*if(client.queue == 0)
        exit(0);*/
    //sprawdzenie parametrów wywołania
    QStringList args = QCoreApplication::arguments();

    if(args.size() > 1)
    {
        if(args.at(1) == "list")
        {
            if(client.send(QStringList() << "GET_AVAILABLE_RESULTS" << "*") == NO_SERVERS)
            {
                std::cout << "nie można się z niczym połączyć lub nikt nie akceptuje zapytań\n";
                exit(10);
            }
        }
        else if(args.at(1) == "get")
        {
            if(client.send(QStringList() << "GET_RESULT" << args.at(2)) == NO_SERVERS)
            {
                std::cout << "nie można się z niczym połączyć lub nikt nie akceptuje zapytań\n";
                exit(10);
            }
        }
        else if(args.at(1) == "find")
        {
            //<nazwa badania>,<kraj>,<płeć>,<rasa>,<minimalny wiek>,<maksymalny wiek>
            if(client.send(QStringList() << "GET_AVAILABLE_RESULTS" << args.at(2) << args.at(3) << \
                           args.at(4) << args.at(5) << args.at(6) << args.at(7)) == NO_SERVERS)
            {
                std::cout << "nie można się z niczym połączyć lub nikt nie akceptuje zapytań\n";
                exit(10);
            }
        }
        else if(args.at(1) == "stats")
        {
            //<nazwa badania>,<data od>,<data do>,<kraj>,<płeć>,<rasa>,<minimalny wiek>,<maksymalny wiek>,
            //{<pole grupowania 1>,<pole grupowania 2>,<...>}
            QStringList a = args.at(10).split("");
            a.pop_back();
            a.pop_front();
            QString grupowanie = "{"+a.join(",")+"}";
            std::cout << grupowanie.toStdString() << std::endl;
            if(client.send(QStringList() << "GET_AVAILABLE_RESULTS" << args.at(2) << args.at(3) << \
                           args.at(4) << args.at(5) << args.at(6) << args.at(7) << args.at(8) << args.at(9)\
                           << grupowanie) == NO_SERVERS)
            {
                std::cout << "nie można się z niczym połączyć lub nikt nie akceptuje zapytań\n";
                exit(10);
            }
        }
    }
    client.socket.waitForReadyRead(15000);
    exit(0);

    return a.exec();
}
开发者ID:Gonz8,项目名称:RSO-16L,代码行数:96,代码来源:main.cpp

示例9: QDialog

CObjectPropertiesDialog::CObjectPropertiesDialog(CObject* obj, QWidget* parent)
	: QDialog(parent),
	m_obj(null)
{
	ui.setupUi(this);

	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	QVector<int> enabledTabs;
	switch (obj->m_type)
	{
	case OT_MOVER:
		enabledTabs.append(0);
		enabledTabs.append(2);
		break;
	case OT_ITEM:
		enabledTabs.append(0);
		break;
	case OT_CTRL:
		enabledTabs.append(0);
		enabledTabs.append(3);
		break;
	case OT_REGION:
		switch (obj->m_modelID)
		{
		case RI_STRUCTURE:
			enabledTabs.append(4);
			break;
		case RI_REVIVAL:
		case RI_PLACE:
			enabledTabs.append(1);
			break;
		case RI_ATTRIBUTE:
		case RI_TRIGGER:
			enabledTabs.append(5);
			break;
		}
		break;
	case OT_PATH:
		enabledTabs.append(6);
		break;
	}

	const int count = ui.tabWidget->tabBar()->count();
	for (int i = 0, j = 0; i < count; i++, j++)
	{
		if (!enabledTabs.contains(i))
		{
			QWidget* widget = ui.tabWidget->widget(j);
			Delete(widget);
			j--;
		}
	}

	ui.tabWidget->setCurrentIndex(0);

	if (obj->m_type == OT_MOVER || obj->m_type == OT_ITEM || obj->m_type == OT_CTRL)
	{
		CSpawnObject* spawn = (CSpawnObject*)obj;
		ui.spawn->setChecked(spawn->m_isRespawn);
		ui.spawnCount->setValue(spawn->m_count);
		ui.spawnAttackCount->setValue(spawn->m_attackCount);
		ui.spawnTime->setValue(spawn->m_time);
		ui.spawnDayMin->setValue(spawn->m_dayMin);
		ui.spawnDayMax->setValue(spawn->m_dayMax);
		ui.spawnHourMin->setValue(spawn->m_hourMin);
		ui.spawnHourMax->setValue(spawn->m_hourMax);
		ui.spawnItemMin->setValue(spawn->m_itemMin);
		ui.spawnItemMax->setValue(spawn->m_itemMax);

		connect(ui.spawn, SIGNAL(clicked(bool)), this, SLOT(SetSpawn(bool)));
		connect(ui.spawnCount, SIGNAL(valueChanged(int)), this, SLOT(SetSpawnCount(int)));

		if (obj->m_type == OT_MOVER)
		{
			CMover* mover = (CMover*)obj;
			CTextFile::FillComboBox(ui.moverAI, "AII_", mover->m_AIInterface);
			CTextFile::FillComboBox(ui.moverBelli, "BELLI_", mover->m_belligerence);
			Project->FillCharacterComboBox(ui.moverNPC, mover->m_characterKey);

			QVector<string> states;
			states.push_back("STATE_INIT");
			states.push_back("STATE_IDLE");
			states.push_back("STATE_WANDER");
			states.push_back("STATE_PURSUE");
			states.push_back("STATE_EVADE");
			states.push_back("STATE_RUNAWAY");
			states.push_back("STATE_RAGE");
			states.push_back("STATE_STAND");
			states.push_back("STATE_PATROL");
			states.push_back("STATE_RAGE_PATROL");
			for (int i = 0; i < states.size(); i++)
			{
				ui.moverAIState->addItem(states[i]);
				if (i + 1 == mover->m_aiState)
					ui.moverAIState->setCurrentIndex(i);
			}

			if (mover->m_world)
			{
//.........这里部分代码省略.........
开发者ID:Aishiro,项目名称:ATools,代码行数:101,代码来源:ObjectProperties.cpp

示例10: renderDiagram

void QgsTextDiagram::renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, QPointF position )
{
  QPainter* p = c.painter();
  if ( !p )
  {
    return;
  }

  //convert from mm / map units to painter units
  QSizeF spu = sizePainterUnits( s.size, s, c );
  double w = spu.width();
  double h = spu.height();

  double baseX = position.x();
  double baseY = position.y() - h;

  QVector<QPointF> textPositions; //midpoints for text placement
  int nCategories = s.categoryAttributes.size();
  for ( int i = 0; i < nCategories; ++i )
  {
    if ( mOrientation == Horizontal )
    {
      textPositions.push_back( QPointF( baseX + ( w / nCategories ) * i + w / nCategories / 2.0, baseY + h / 2.0 ) );
    }
    else //vertical
    {
      textPositions.push_back( QPointF( baseX + w / 2.0, baseY + h / nCategories * i + w / nCategories / 2.0 ) );
    }
  }

  mPen.setColor( s.penColor );
  setPenWidth( mPen, s, c );
  p->setPen( mPen );
  mBrush.setColor( s.backgroundColor );
  p->setBrush( mBrush );

  //draw shapes and separator lines first
  if ( mShape == Circle )
  {
    p->drawEllipse( baseX, baseY, w, h );

    //draw separator lines
    QList<QPointF> intersect; //intersections between shape and separation lines
    QPointF center( baseX + w / 2.0, baseY + h / 2.0 );
    double r1 = w / 2.0;
    double r2 = h / 2.0;

    for ( int i = 1; i < nCategories; ++i )
    {
      if ( mOrientation == Horizontal )
      {
        lineEllipseIntersection( QPointF( baseX + w / nCategories * i, baseY ), QPointF( baseX + w / nCategories * i, baseY + h ), center, r1, r2, intersect );
      }
      else //vertical
      {
        lineEllipseIntersection( QPointF( baseX, baseY + h / nCategories * i ), QPointF( baseX + w, baseY + h / nCategories * i ), center, r1, r2, intersect );
      }
      if ( intersect.size() > 1 )
      {
        p->drawLine( intersect.at( 0 ), intersect.at( 1 ) );
      }
    }
  }
  else if ( mShape == Rectangle )
  {
    p->drawRect( QRectF( baseX, baseY, w, h ) );
    for ( int i = 1; i < nCategories; ++i )
    {
      if ( mOrientation == Horizontal )
      {
        p->drawLine( QPointF( baseX + w / nCategories * i, baseY ), QPointF( baseX + w / nCategories * i, baseY + h ) );
      }
      else
      {
        p->drawLine( QPointF( baseX, baseY + h / nCategories * i ), QPointF( baseX + w, baseY + h / nCategories * i ) );
      }
    }
  }
  else //triangle
  {
    QPolygonF triangle;
    triangle << QPointF( baseX, baseY + h ) << QPointF( baseX + w, baseY + h ) << QPointF( baseX + w / 2.0, baseY );
    p->drawPolygon( triangle );

    QLineF triangleEdgeLeft( baseX + w / 2.0, baseY, baseX, baseY + h );
    QLineF triangleEdgeRight( baseX + w, baseY + h, baseX + w / 2.0, baseY );
    QPointF intersectionPoint1, intersectionPoint2;

    for ( int i = 1; i < nCategories; ++i )
    {
      if ( mOrientation == Horizontal )
      {
        QLineF verticalLine( baseX + w / nCategories * i, baseY + h, baseX + w / nCategories * i, baseY );
        if ( baseX + w / nCategories * i < baseX + w / 2.0 )
        {
          verticalLine.intersect( triangleEdgeLeft, &intersectionPoint1 );
        }
        else
        {
          verticalLine.intersect( triangleEdgeRight, &intersectionPoint1 );
//.........这里部分代码省略.........
开发者ID:AM7000000,项目名称:QGIS,代码行数:101,代码来源:qgstextdiagram.cpp

示例11: readAsaElcFile

bool LayoutLoader::readAsaElcFile(const QString& path, QStringList &channelNames, QList<QVector<double> > &location3D, QList<QVector<double> > &location2D, QString &unit)
{
    //Open .elc file
    if(!path.contains(".elc"))
        return false;

    QFile file(path);
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qDebug()<<"Error opening elc file";
        return false;
    }

    //Start reading from file
    double numberElectrodes;
    QTextStream in(&file);
    bool read2D = false;

    while(!in.atEnd())
    {
        QString line = in.readLine();

        QStringList fields = line.split(QRegExp("\\s+"));

        //Delete last element if it is a blank character
        if(fields.at(fields.size()-1) == "")
            fields.removeLast();

        if(!line.contains("#")) //Skip commented areas in file
        {
            //Read number of electrodes
            if(line.contains("NumberPositions"))
                numberElectrodes = fields.at(1).toDouble();

            //Read the unit of the position values
            if(line.contains("UnitPosition"))
                unit = fields.at(1);

            //Read actual electrode positions
            if(line.contains("Positions2D"))
                read2D = true;

            if(line.contains(":") && !read2D) //Read 3D positions
            {
                channelNames.push_back(fields.at(0));
                QVector<double> posTemp;

                posTemp.push_back(fields.at(fields.size()-3).toDouble());    //x
                posTemp.push_back(fields.at(fields.size()-2).toDouble());    //y
                posTemp.push_back(fields.at(fields.size()-1).toDouble());    //z

                location3D.append(posTemp);
            }

            if(line.contains(":") && read2D) //Read 2D positions
            {
                QVector<double> posTemp;
                posTemp.push_back(fields.at(fields.size()-2).toDouble());    //x
                posTemp.push_back(fields.at(fields.size()-1).toDouble());    //y
                location2D.append(posTemp);
            }

            //Read channel names
            if(line.contains("Labels"))
            {
                line = in.readLine();
                fields = line.split(QRegExp("\\s+"));

                //Delete last element if it is a blank character
                if(fields.at(fields.size()-1) == "")
                    fields.removeLast();

                channelNames = fields;
            }
        }
    }

    Q_UNUSED(numberElectrodes);

    file.close();

    return true;
}
开发者ID:eh1255,项目名称:mne-cpp,代码行数:82,代码来源:layoutloader.cpp

示例12: assert

void OsmAnd::MapRasterizer_P::rasterizePolygon(
    const Context& context,
    SkCanvas& canvas,
    const std::shared_ptr<const MapPrimitiviser::Primitive>& primitive)
{
    const auto& points31 = primitive->sourceObject->points31;
    const auto& area31 = context.area31;

    assert(points31.size() > 2);
    assert(primitive->sourceObject->isClosedFigure());
    assert(primitive->sourceObject->isClosedFigure(true));

    //////////////////////////////////////////////////////////////////////////
    //if ((primitive->sourceObject->id >> 1) == 9223372032559801460u)
    //{
    //    int i = 5;
    //}
    //////////////////////////////////////////////////////////////////////////

    SkPaint paint = _defaultPaint;
    if (!updatePaint(context, paint, primitive->evaluationResult, PaintValuesSet::Layer_1, true))
        return;

    // Construct and test geometry against bbox area
    SkPath path;
    bool containsAtLeastOnePoint = false;
    int pointIdx = 0;
    PointF vertex;
    Utilities::CHValue prevChValue;
    QVector< PointI > outerPoints;
    const auto pointsCount = points31.size();
    auto pPoint = points31.constData();
    for (auto pointIdx = 0; pointIdx < pointsCount; pointIdx++, pPoint++)
    {
        const auto& point = *pPoint;
        calculateVertex(context, point, vertex);

        // Hit-test
        if (!containsAtLeastOnePoint)
        {
            if (area31.contains(point))
                containsAtLeastOnePoint = true;
            else
                outerPoints.push_back(point);

            const auto chValue = Utilities::computeCohenSutherlandValue(point, area31);
            if (Q_LIKELY(pointIdx > 0))
            {
                // Check if line crosses area (reject only if points are on the same side)
                const auto intersectedChValue = prevChValue & chValue;
                if (static_cast<unsigned int>(intersectedChValue) != 0)
                    containsAtLeastOnePoint = true;
            }
            prevChValue = chValue;
        }

        // Plot vertex
        if (pointIdx == 0)
            path.moveTo(vertex.x, vertex.y);
        else
            path.lineTo(vertex.x, vertex.y);
    }

    //////////////////////////////////////////////////////////////////////////
    //if ((primitive->sourceObject->id >> 1) == 9223372032559801460u)
    //{
    //    int i = 5;
    //}
    //////////////////////////////////////////////////////////////////////////

    if (!containsAtLeastOnePoint)
    {
        // Check area is inside polygon
        bool ok = true;
        ok = ok || containsHelper(outerPoints, area31.topLeft);
        ok = ok || containsHelper(outerPoints, area31.bottomRight);
        ok = ok || containsHelper(outerPoints, PointI(0, area31.bottom()));
        ok = ok || containsHelper(outerPoints, PointI(area31.right(), 0));
        if (!ok)
            return;
    }

    //////////////////////////////////////////////////////////////////////////
    //if ((primitive->sourceObject->id >> 1) == 95692962u)
    //{
    //    int i = 5;
    //}
    //////////////////////////////////////////////////////////////////////////

    if (!primitive->sourceObject->innerPolygonsPoints31.isEmpty())
    {
        path.setFillType(SkPath::kEvenOdd_FillType);
        for (const auto& polygon : constOf(primitive->sourceObject->innerPolygonsPoints31))
        {
            pointIdx = 0;
            for (auto itVertex = cachingIteratorOf(constOf(polygon)); itVertex; ++itVertex, pointIdx++)
            {
                const auto& point = *itVertex;
                calculateVertex(context, point, vertex);

//.........这里部分代码省略.........
开发者ID:biddyweb,项目名称:OsmAnd-core,代码行数:101,代码来源:MapRasterizer_P.cpp

示例13: l_get_next_buffer_of_timecode

int l_get_next_buffer_of_timecode(QStringList    &csv_data,
                                  QVector<float> &channel_1,
                                  QVector<float> &channel_2,
                                  float          &expected_speed)
{
    // Init.
    channel_1.clear();
    channel_2.clear();
    expected_speed = -99; // speed not found.

    if (csv_data.size() == 0)
    {
        return true; // EOF
    }

    QString line = csv_data.at(0);
    csv_data.removeAt(0);
    if (csv_data.size() == 0)
    {
        return true; // EOF
    }

    // Parse until beginning of a buffer.
    while (line.startsWith("buffer_size;speed") == false)
    {
        line = csv_data.at(0);
        csv_data.removeAt(0);
        if (csv_data.size() == 0)
        {
            return true; // EOF
        }
    }

    // Get line for buffer size and expected speed.
    line = csv_data.at(0);
    csv_data.removeAt(0);
    if (csv_data.size() == 0)
    {
        return true; // EOF
    }
    QStringList buffer_and_speed = line.split(';');

    // Remove "channel1;channel2"
    line = csv_data.at(0);
    csv_data.removeAt(0);
    if (csv_data.size() == 0)
    {
        return true; // EOF
    }

    // Get buffer size.
    int buffer_size = buffer_and_speed.at(0).toInt();

    // Get data.
    if (csv_data.size() >= buffer_size)
    {
        for (int i = 0; i < buffer_size; i++)
        {
            line = csv_data.at(0);
            csv_data.removeAt(0);
            channel_1.push_back(line.split(';').at(0).toFloat());
            channel_2.push_back(line.split(';').at(1).toFloat());
        }
    }
    else
    {
        return true; // EOF
    }

    // Get expected speed.
    if (buffer_and_speed.at(1) != "TODO")
    {
        expected_speed = buffer_and_speed.at(1).toFloat();
    }

    return false;
}
开发者ID:jrosener,项目名称:digitalscratch,代码行数:77,代码来源:test_utils.cpp

示例14: if

QVector<QVector<Tile>> Maze::setTileDistances(QVector<QVector<Tile>> maze) {

    // TODO: MACK - dedup some of this with hasNoInaccessibleLocations

    // The maze is guarenteed to be nonempty and rectangular
    int width = maze.size();
    int height = maze.at(0).size();

    // Helper lambda for retrieving and adjacent tile if one exists, nullptr if not
    // TODO: MACK - this should be in maze utilities too
    auto getNeighbor = [&maze, &width, &height](int x, int y, Direction direction) {
        switch (direction) {
            case Direction::NORTH:
                return (y < height - 1 ? &maze[x][y + 1] : nullptr);
            case Direction::EAST:
                return (x < width - 1 ? &maze[x + 1][y] : nullptr);
            case Direction::SOUTH:
                return (0 < y ? &maze[x][y - 1] : nullptr);
            case Direction::WEST:
                return (0 < x ? &maze[x - 1][y] : nullptr);
        }
    };

    // Determine all of the center tiles
    // TODO: MACK - use the maze checker function for this
    QVector<Tile*> centerTiles;
            centerTiles.push_back(&maze[(width - 1) / 2][(height - 1) / 2]);
    if (width % 2 == 0) {
            centerTiles.push_back(&maze[ width      / 2][(height - 1) / 2]);
        if (height % 2 == 0) {
            centerTiles.push_back(&maze[(width - 1) / 2][ height      / 2]);
            centerTiles.push_back(&maze[ width      / 2][ height      / 2]);
        }
    }
    else if (height % 2 == 0) {
            centerTiles.push_back(&maze[(width - 1) / 2][ height      / 2]);
    }

    // The queue for the BFS
    QQueue<Tile*> discovered;

    // Set the distances of the center tiles and push them to the queue
    for (Tile* tile : centerTiles) {
        tile->setDistance(0); 
        discovered.enqueue(tile);
    }

    // Now do a BFS
    while (!discovered.empty()){
        Tile* tile = discovered.dequeue();
        for (Direction direction : DIRECTIONS) {
            if (!tile->isWall(direction)) {
                Tile* neighbor = getNeighbor(tile->getX(), tile->getY(), direction);
                if (neighbor != nullptr && neighbor->getDistance() == -1) {
                    neighbor->setDistance(tile->getDistance() + 1);
                    discovered.enqueue(neighbor);
                }
            }
        }
    }

    return maze;
}
开发者ID:nosirromd,项目名称:mms,代码行数:63,代码来源:Maze.cpp

示例15: rec

void ValgrindMemcheckParserTest::testMemcheckSample1()
{
    initTest("memcheck-output-sample1.xml");

    QList<Error> expectedErrors;
    {
        Error error;
        error.setKind(InvalidRead);
        error.setWhat("Invalid read of size 4");
        error.setUnique(0x9);
        error.setTid(1);
        Frame f1;
        f1.setInstructionPointer(0x6E47964);
        f1.setObject("/usr/lib/libQtGui.so.4.7.0");
        f1.setFunctionName("QFrame::frameStyle() const");
        f1.setDirectory("/build/buildd/qt4-x11-4.7.0/src/gui/widgets");
        f1.setFileName("qframe.cpp");
        f1.setLine(252);
        Frame f2;
        f2.setInstructionPointer(0x118F2AF7);
        f2.setObject("/usr/lib/kde4/plugins/styles/oxygen.so");
        Frame f3;
        f3.setInstructionPointer(0x6A81671);
        f3.setObject("/usr/lib/libQtGui.so.4.7.0");
        f3.setFunctionName("QWidget::event(QEvent*)");
        f3.setDirectory("/build/buildd/qt4-x11-4.7.0/src/gui/kernel");
        f3.setFileName("qwidget.cpp");
        f3.setLine(8273);
        Frame f4;
        f4.setInstructionPointer(0x6A2B6EB);
        f4.setObject("/usr/lib/libQtGui.so.4.7.0");
        f4.setDirectory("/build/buildd/qt4-x11-4.7.0/src/gui/kernel");
        f4.setFileName("qapplication.cpp");
        f4.setFunctionName("QApplicationPrivate::notify_helper(QObject*, QEvent*)");
        f4.setLine(4396);
        Stack s1;
        s1.setAuxWhat("Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd");
        s1.setFrames(QVector<Frame>() << f1 << f2 << f3 << f4);
        error.setStacks( QVector<Stack>() << s1 );

        expectedErrors << error;
    }

    QVector<QPair<qint64,qint64> > expectedErrorCounts;
    expectedErrorCounts.push_back(QPair<qint64,qint64>(9, 2));

    QVector<QPair<QString,qint64> > expectedSuppCounts;
    expectedSuppCounts.push_back(qMakePair(QString("X on SUSE11 writev uninit padding"), static_cast<qint64>(12)));
    expectedSuppCounts.push_back(qMakePair(QString("dl-hack3-cond-1"), static_cast<qint64>(2)));
    expectedSuppCounts.push_back(qMakePair(QString("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), static_cast<qint64>(2)));

    Parser parser;
    Recorder rec(&parser);

    parser.parse(m_socket);

    m_process->waitForFinished();
    QCOMPARE(m_process->exitStatus(), QProcess::NormalExit);
    QCOMPARE(m_process->state(), QProcess::NotRunning);

    QVERIFY2(parser.errorString().isEmpty(), qPrintable(parser.errorString()));
    const QList<Error> actualErrors = rec.errors;

    if (actualErrors.first() != expectedErrors.first()) {
        dumpError(actualErrors.first());
        dumpError(expectedErrors.first());
    }

    QCOMPARE(actualErrors.first(), expectedErrors.first());

    QCOMPARE(actualErrors.size(), 3);

    QCOMPARE(rec.errorcounts, expectedErrorCounts);
    QCOMPARE(rec.suppcounts, expectedSuppCounts);
}
开发者ID:choenig,项目名称:qt-creator,代码行数:75,代码来源:valgrindmemcheckparsertest.cpp


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