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


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

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


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

示例1: detectLCSInIntLists

/*QList<int>* LCSGenerator::_internal_detectLCSInIntLists(QList<int> *original, QList<int> *newList) {

    using namespace std;
#if TEST_MEMIO
    static int times = 0;
    times++;
    cout << times << endl;
#endif
    QList<int>* ret = new QList<int>;
    if(original->isEmpty() || newList->isEmpty()) {
        return ret;
    }
    QList<int>* shortenedOriginal = new QList<int>(*original);
    QList<int>* shortenedNew = new QList<int>(*newList);
    shortenedOriginal->removeLast();
    shortenedNew->removeLast();
    if(original->last() == newList->last()) {
        *ret += *detectLCSInIntLists(shortenedOriginal, shortenedNew);
        ret->append(original->last());
    } else {
        QList<int>* lcsWithShortenedNew = detectLCSInIntLists(original, shortenedNew);
        QList<int>* lcsWithShortenedOriginal = detectLCSInIntLists(shortenedOriginal, newList);
        if(lcsWithShortenedNew->size() > lcsWithShortenedOriginal->size()) {
            *ret += *lcsWithShortenedNew;
        } else {
            *ret += *lcsWithShortenedOriginal;
        }
    }
    return ret;

}
QList<int>* LCSGenerator::detectLCSInIntLists(QList<int> *original, QList<int> *newList) {
    QList<int>* cat;
    cat = new QList<int>(*original+*newList);
    if(table->contains(*cat)) {
        return new QList<int>(table->value(*cat));
    } else {
        QList<int>* ret = _internal_detectLCSInIntLists(original, newList);
        table->insert(*cat, *ret);
        return ret;
    }
    //return _internal_detectLCSInIntLists(original, newList);

}*/
QList<QString*>* LCSGenerator::_internal_lcsForStringLists(QList<QString *> *original, QList<QString *> *newList){
#if TEST_MEMIO
    using namespace std;
    static int times = 0;
    times++;
    cout << times << endl;
#endif
    if(original->isEmpty() || newList->isEmpty()) {
        return new QList<QString*>;
    }
    QList<QString*>* shortenedOriginal = new QList<QString*>(*original);
    QList<QString*>* shortenedNew = new QList<QString*>(*newList);
    shortenedOriginal->removeLast();
    shortenedNew->removeLast();
    QList<QString*>* ret = new QList<QString*>;
    if(*(original->last()) == *(newList->last())) {
        QList<QString*>* lcs = lcsForStringLists(shortenedOriginal, shortenedNew);
        *ret += *lcs;
        delete lcs;
        ret->append(original->last());
    } else {
        QList<QString*>* lcsWithShortenedNew = lcsForStringLists(original, shortenedNew);
        QList<QString*>* lcsWithShortenedOriginal = lcsForStringLists(shortenedOriginal, newList);
        if(lcsWithShortenedNew->size() > lcsWithShortenedOriginal->size()) {
            *ret += *lcsWithShortenedNew;
        } else {
            *ret += *lcsWithShortenedOriginal;
        }
        delete lcsWithShortenedNew;
        delete lcsWithShortenedOriginal;
    }
    delete shortenedOriginal;
    delete shortenedNew;
    return ret;
}
开发者ID:ograff,项目名称:Diff-tool,代码行数:79,代码来源:lcsgenerator.cpp

示例2: findItemByRoot

ParserTreeItem::ConstPtr Parser::findItemByRoot(const QStandardItem *item, bool skipRoot) const
{
    if (!item)
        return ParserTreeItem::ConstPtr();

    // go item by item to the root
    QList<const QStandardItem *> uiList;
    const QStandardItem *cur = item;
    while (cur) {
        uiList.append(cur);
        cur = cur->parent();
    }

    if (skipRoot && uiList.count() > 0)
        uiList.removeLast();

    QReadLocker locker(&d->rootItemLocker);

    // using internal root - search correct item
    ParserTreeItem::ConstPtr internal = d->rootItem;

    while (uiList.count() > 0) {
        cur = uiList.last();
        uiList.removeLast();
        const SymbolInformation &inf = Utils::symbolInformationFromItem(cur);
        internal = internal->child(inf);
        if (internal.isNull())
            break;
    }

    return internal;
}
开发者ID:colede,项目名称:qtcreator,代码行数:32,代码来源:classviewparser.cpp

示例3: clearAllItems

void SchematicScene::clearAllItems()
{
	clearSelection();
	m_highlightedLinks.clear();
	QList<SchematicWindowEditor *> editors;
	QList<SchematicNode *> nodes;
	QList<SchematicLink *> links;
	int i;
	QList<QGraphicsItem *> sceneItems = items();
	int size = sceneItems.size();
	//create nodes and links list
	for (i = 0; i < size; i++) {
		QGraphicsItem *item = sceneItems.at(i);
		SchematicWindowEditor *editor = dynamic_cast<SchematicWindowEditor *>(item);
		SchematicNode *node = dynamic_cast<SchematicNode *>(item);
		SchematicLink *link = dynamic_cast<SchematicLink *>(item);
		if (editor)
			editors.append(editor);
		if (node)
			nodes.append(node);
		if (link)
			links.append(link);
	}
	while (links.size() > 0) {
		SchematicLink *link = links.back();
		removeItem(link);
		links.removeLast();
		SchematicPort *startPort = link->getStartPort();
		SchematicPort *endPort = link->getEndPort();
		if (startPort)
			startPort->removeLink(link);
		if (endPort)
			endPort->removeLink(link);
		delete link;
	}
	while (editors.size() > 0) {
		SchematicWindowEditor *editor = editors.back();
		removeItem(editor);
		editors.removeLast();
		delete editor;
	}
	while (nodes.size() > 0) {
		SchematicNode *node = nodes.back();
		removeItem(node);
		nodes.removeLast();
		delete node;
	}
	assert(items().size() == 0);
}
开发者ID:Lisy09Personal,项目名称:opentoonz,代码行数:49,代码来源:schematicviewer.cpp

示例4: logcatProcess

void AndroidRunnerWorker::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError)
{
    QList<QByteArray> lines = text.split('\n');
    // lines always contains at least one item
    lines[0].prepend(buffer);
    if (!lines.last().endsWith('\n')) {
        // incomplete line
        buffer = lines.last();
        lines.removeLast();
    } else {
        buffer.clear();
    }

    QString pidString = QString::number(m_processPID);
    foreach (const QByteArray &msg, lines) {
        const QString line = QString::fromUtf8(msg).trimmed() + QLatin1Char('\n');
        if (!line.contains(pidString))
            continue;
        if (m_useCppDebugger) {
            switch (m_jdbState) {
            case JDBState::Idle:
                if (msg.trimmed().endsWith("Sending WAIT chunk")) {
                    m_jdbState = JDBState::Waiting;
                    handleJdbWaiting();
                }
                break;
            case JDBState::Waiting:
                if (msg.indexOf("debugger has settled") > 0) {
                    m_jdbState = JDBState::Settled;
                    handleJdbSettled();
                }
                break;
            default:
                break;
            }
        }
        if (m_logCatRegExp.exactMatch(line)) {
            // Android M
            if (m_logCatRegExp.cap(1) == pidString) {
                const QString &messagetype = m_logCatRegExp.cap(2);
                QString output = line.mid(m_logCatRegExp.pos(2));

                if (onlyError
                        || messagetype == QLatin1String("F")
                        || messagetype == QLatin1String("E")
                        || messagetype == QLatin1String("W"))
                    emit remoteErrorOutput(output);
                else
                    emit remoteOutput(output);
            }
        } else {
            if (onlyError || line.startsWith("F/")
                    || line.startsWith("E/")
                    || line.startsWith("W/"))
                emit remoteErrorOutput(line);
            else
                emit remoteOutput(line);
        }
    }
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:60,代码来源:androidrunnerworker.cpp

示例5: multiRef

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

示例6: multiVal

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

示例7: DonneesJoueurs

void thJeu::DonneesJoueurs(QString NomJoueur, QByteArray Donnees)
{
    QList<QByteArray> TrameDonnees;
    QList<QByteArray> ListePoints;
    int I = 0;
    while (I < m_Joueurs.count() && NomJoueur != m_Joueurs[I]->m_Nom)
        I++;

    if (I != m_Joueurs.count())
    {
        TrameDonnees = Donnees.split('\n');

        if (TrameDonnees.count() > 2)
        {
            ListePoints = TrameDonnees[2].split('\t');
            ListePoints.removeLast();
            if (TrameDonnees[1].toInt() == 0)
            {
                m_Joueurs[I]->m_jBase->m_Commandes.clear();
                for (int J = 0; J < ListePoints.count(); J+=2)
                    m_Joueurs[I]->m_jBase->m_Commandes.append(QPoint(ListePoints[J].toInt(), ListePoints[J+1].toInt()));
            }
            else
            {
                m_Joueurs[I]->m_Armees[TrameDonnees[1].toInt()-1]->m_Commandes.clear();
                for (int J = 0; J < ListePoints.count(); J+=2)
                    m_Joueurs[I]->m_Armees[TrameDonnees[1].toInt()-1]->m_Commandes.append(QPoint(ListePoints[J].toInt(), ListePoints[J+1].toInt()));
            }
        }
    }
}
开发者ID:massicotteg,项目名称:PixelATRServeur,代码行数:31,代码来源:thjeu.cpp

示例8:

QList<Person> PersonsTableModel::persons() const
{
    QList<Person> persons = d_func()->persons;
    if(!persons.isEmpty() && persons.last().name().isEmpty())
        persons.removeLast();
    return persons;
}
开发者ID:comargo,项目名称:dutylist,代码行数:7,代码来源:personstablemodel.cpp

示例9: setViewMode

void Settings::setViewMode(int value)
{
    int type = getSigninType();
    if (getViewMode() != value) {
        if (type < 10) {
            // Netvibes, Forbidden modes: 6, 7
            if (value == 6 || value == 7) {
                qWarning() << "Netvibes forbidden mode!";
                return;
            }
        } else if (type >= 10 && type < 20) {
            // OldReader, Forbidden modes: none
        } else if (type >= 20 && type < 30) {
            // Feedly, Forbidden modes: 6, 7
            if (value == 6 || value == 7) {
                qWarning() << "Old Reader forbidden mode!";
                return;
            }
        }

        settings.setValue("viewmode", value);

        //update history
        QList<QVariant> list = settings.value("viewmodehistory").toList();
        if (list.indexOf(value)==-1)
            list.prepend(value);
        if (list.length()>3)
            list.removeLast();
        settings.setValue("viewmodehistory", list);

        emit viewModeChanged();
    }
}
开发者ID:icaruseffect,项目名称:kaktus,代码行数:33,代码来源:settings.cpp

示例10: logcatProcess

void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError)
{
    QList<QByteArray> lines = text.split('\n');
    // lines always contains at least one item
    lines[0].prepend(buffer);
    if (!lines.last().endsWith('\n')) {
        // incomplete line
        buffer = lines.last();
        lines.removeLast();
    } else {
        buffer.clear();
    }

    QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1());
    foreach (QByteArray line, lines) {
        if (!line.contains(pid))
            continue;
        if (line.endsWith('\r'))
            line.chop(1);
        line.append('\n');
        if (onlyError || line.startsWith("F/")
                || line.startsWith("E/")
                || line.startsWith("D/Qt")
                || line.startsWith("W/"))
            emit remoteErrorOutput(line);
        else
            emit remoteOutput(line);

    }
}
开发者ID:Herysutrisno,项目名称:qt-creator,代码行数:30,代码来源:androidrunner.cpp

示例11: changeNumberPorts

void RouterItem::changeNumberPorts(int newSize){
	if(numberPorts != newSize){

		numberPorts = newSize;
		int oldSize = childItems().count();

		if(oldSize < numberPorts){
			for(int i=oldSize; i<numberPorts; ++i){
				PortItem *port = new PortItem(this);
				port->setData(5, "Port");
			}
		}

		if(oldSize > numberPorts){
			QList<QGraphicsItem *> list = childItems();
			while(list.size() != numberPorts){

				//удаляем все связи
				PortItem* port = qgraphicsitem_cast<PortItem*>(list.last());
				emit portDeleted(port);

				this->scene()->removeItem(list.last());
				delete list.last();
				list.removeLast();
			}
		}
		setPortsPosition();
	}
}
开发者ID:seisuiseki,项目名称:Bydlocode,代码行数:29,代码来源:routeritem.cpp

示例12: Start

void TCPBase::Start(bool couldCancelPreviousRequest)
{
    if(srvsList.isEmpty())
    {
        srvsList.push_back(this);
        RealStart();
    }
    else
    {
        TCPBase * last = srvsList.last();
        if(couldCancelPreviousRequest
            && last->couldBeRemoved()
            && (last->isConnected() || !last->hasStarted())
            && (last->parent() == parent()))
        {
            srvsList.removeLast();
            last->deleteLater();
            Start(couldCancelPreviousRequest);
        } else
        {
            connect(last, SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
            srvsList.push_back(this);
        }
    }
}
开发者ID:akzfowl,项目名称:hw,代码行数:25,代码来源:tcpBase.cpp

示例13: parseMessage

void PanelPlot::parseMessage(QByteArray data)
{
    double key = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0;
    QString messages = data;
    messages.chop(1); // remove LF
    QList<QString> message = messages.split(',');
    if (message.last() == "")
        message.removeLast();
    if (message.size() == plotSize)
    {
        for (int index=0; index < plotSize; index++)
        {
            if (ui->plotNames->item(index)->checkState() == Qt::Checked)
            {
                double dataValue = message[index].toDouble();
                ui->plotWindow->graph(index)->addData(key, dataValue);
                ui->plotWindow->graph(index)->removeDataBefore(key-timeAxisLength);
            }
        }
        // make key axis range scroll with the data (at a constant range size of 10)
        ui->plotWindow->xAxis->setRange(key+0.25, timeAxisLength, Qt::AlignRight);
        ui->plotWindow->replot();
        ui->plotWindow->rescaleAxes(true);
    }
    else if (message.size() > plotSize)
        emit panelStatus("Plot count (" + QString::number(message.size()) +") does not match plot count in XML configuration file (" + QString::number(plotSize) +")");
}
开发者ID:kyky2000,项目名称:AeroQuadCommunicator,代码行数:27,代码来源:panel_plot.cpp

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

示例15: CurveMaxChanged

void MixerCurve::CurveMaxChanged(double value)
{
    // the max changed so redraw the curve
    // mixercurvewidget::setCurve will trim any points above max
    QList<double> points = m_curve->getCurve();
    points.removeLast();
    points.append(value);
    setCurve(&points);
}
开发者ID:nongxiaoming,项目名称:QGroundStation,代码行数:9,代码来源:mixercurve.cpp


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