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


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

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


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

示例1: markDomain

static void markDomain(CT& ct,FaceHandle start,int index,QList<Edge>& border)
{
	QList<FaceHandle> queue;
	queue.append(start);
	while(!queue.isEmpty()) {
		FaceHandle fh=queue.takeFirst();
		fh->info().nestingLevel=index;
		for(auto i=0; i<3; ++i) {
			FaceHandle n=fh->neighbor(i);
			if(!n->info().isNested()) {
				Edge e(fh,i);
				if(ct.is_constrained(e))
					border.append(e);
				else
					queue.append(n);
			}
		}
	}
}
开发者ID:GilesBathgate,项目名称:RapCAD,代码行数:19,代码来源:cgalbuilder.cpp

示例2: onHandleUnsupportedContent

void HelpPage::onHandleUnsupportedContent(QNetworkReply *reply)
{
    // sub resource of this page
    if (m_loadingUrl != reply->url()) {
        qWarning() << "Resource" << reply->url().toEncoded() << "has unknown Content-Type, will be ignored.";
        reply->deleteLater();
        return;
    }

    // set a default error string we are going to display
    QString errorString = HelpViewer::tr("Unknown or unsupported content.");
    if (reply->error() == QNetworkReply::NoError) {
        // try to open the url using using the desktop service
        if (QDesktopServices::openUrl(reply->url())) {
            reply->deleteLater();
            return;
        }
        // seems we failed, now we show the error page inside creator
    } else {
        errorString = reply->errorString();
    }

    const QString html = QString::fromUtf8(LocalHelpManager::loadErrorMessage(reply->url(),
                                                                              errorString));

    // update the current layout
    QList<QWebFrame*> frames;
    frames.append(mainFrame());
    while (!frames.isEmpty()) {
        QWebFrame *frame = frames.takeFirst();
        if (frame->url() == reply->url()) {
            frame->setHtml(html, reply->url());
            return;
        }

        QList<QWebFrame *> children = frame->childFrames();
        foreach (QWebFrame *frame, children)
            frames.append(frame);
    }

    if (m_loadingUrl == reply->url())
        mainFrame()->setHtml(html, reply->url());
}
开发者ID:UIKit0,项目名称:qt-creator,代码行数:43,代码来源:qtwebkithelpviewer.cpp

示例3: on_DeleteBtn_clicked

///
/// Delete serverList entry
///
void SoundLibraryRepositoryDialog::on_DeleteBtn_clicked()
{
	QList<QListWidgetItem *> selectedItems;
	selectedItems = ServerListWidget->selectedItems();

	//std::list<std::string>::const_iterator cur_Server;
	H2Core::Preferences *pPref = H2Core::Preferences::get_instance();

	while( ! selectedItems.isEmpty() ){

		QString selText;
	
		selText = selectedItems.takeFirst()->text();

		pPref->sServerList.remove(selText);

	}
	updateDialog();
}
开发者ID:AdamFf,项目名称:hydrogen,代码行数:22,代码来源:SoundLibraryRepositoryDialog.cpp

示例4: addTextDocument

void QQuickTextNode::addTextDocument(const QPointF &position, QTextDocument *textDocument,
                                  const QColor &textColor,
                                  QQuickText::TextStyle style, const QColor &styleColor,
                                  const QColor &anchorColor,
                                  const QColor &selectionColor, const QColor &selectedTextColor,
                                  int selectionStart, int selectionEnd)
{
    initEngine(textColor, selectedTextColor, selectionColor, anchorColor);

    QList<QTextFrame *> frames;
    frames.append(textDocument->rootFrame());
    while (!frames.isEmpty()) {
        QTextFrame *textFrame = frames.takeFirst();
        frames.append(textFrame->childFrames());

        m_engine->addFrameDecorations(textDocument, textFrame);

        if (textFrame->firstPosition() > textFrame->lastPosition()
         && textFrame->frameFormat().position() != QTextFrameFormat::InFlow) {
            const int pos = textFrame->firstPosition() - 1;
            ProtectedLayoutAccessor *a = static_cast<ProtectedLayoutAccessor *>(textDocument->documentLayout());
            QTextCharFormat format = a->formatAccessor(pos);
            QRectF rect = a->frameBoundingRect(textFrame);

            QTextBlock block = textFrame->firstCursorPosition().block();
            m_engine->setCurrentLine(block.layout()->lineForTextPosition(pos - block.position()));
            m_engine->addTextObject(rect.topLeft(), format, QQuickTextNodeEngine::Unselected, textDocument,
                                 pos, textFrame->frameFormat().position());
        } else {
            QTextFrame::iterator it = textFrame->begin();

            while (!it.atEnd()) {
                Q_ASSERT(!m_engine->currentLine().isValid());

                QTextBlock block = it.currentBlock();
                m_engine->addTextBlock(textDocument, block, position, textColor, anchorColor, selectionStart, selectionEnd);
                ++it;
            }
        }
    }

    m_engine->addToSceneGraph(this, style, styleColor);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:43,代码来源:qquicktextnode.cpp

示例5: mouseMoveEvent

void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
{
    if (!dragEnabled())
    {
        event->ignore();
        return;
    }

    if (!(event->buttons() & Qt::LeftButton))
        return;

    if ((event->pos() - mMousePressPos).manhattanLength()
             < QApplication::startDragDistance())
             return;

    QList<QGraphicsItem*> graphicsItems = items(mMousePressPos);

    UBSceneThumbnailPixmap* sceneItem = 0;

    while (!graphicsItems.isEmpty() && !sceneItem)
    {
        sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(graphicsItems.takeFirst());
    }

    if (sceneItem)
    {
        QDrag *drag = new QDrag(this);
        QList<UBMimeDataItem> mimeDataItems;
        foreach (QGraphicsItem *item, selectedItems())
            mimeDataItems.append(UBMimeDataItem(sceneItem->proxy(), mGraphicItems.indexOf(item)));
        UBMimeData *mime = new UBMimeData(mimeDataItems);
        drag->setMimeData(mime);

        drag->setPixmap(sceneItem->pixmap().scaledToWidth(100));
        drag->setHotSpot(QPoint(drag->pixmap().width()/2,
                                     drag->pixmap().height() / 2));

        drag->exec(Qt::MoveAction);
    }

    UBThumbnailWidget::mouseMoveEvent(event);
}
开发者ID:colombc,项目名称:Sankore-3.1,代码行数:42,代码来源:UBDocumentThumbnailWidget.cpp

示例6: execComm

void LC_Align::execComm(Document_Interface *doc,
                             QWidget *parent, QString cmd)
{
    Q_UNUSED(parent);
    Q_UNUSED(cmd);
    QPointF base1, base2, target1, target2;
    QList<Plug_Entity *> obj;
    bool yes  = doc->getSelect(&obj);
    if (!yes || obj.isEmpty()) return;
    yes = doc->getPoint(&base1, QString(tr("first base point:")));
    if (yes) {
        yes = doc->getPoint(&target1, QString(tr("first target point:")), &base1);
        if (yes) {
            yes = doc->getPoint(&base2, QString(tr("second base point:")));
            if (yes) {
                yes = doc->getPoint(&target2, QString(tr("second target point:")), &base2);
            }
        }

    }
    if (yes) {
        //first, move selection
        QPointF movev = target1 - base1;

        //calculate angle
        double abase, atarget, angle;
        abase = atan2( base2.y() - base1.y(),
                       base2.x() - base1.x());
        atarget = atan2( target2.y() - target1.y(),
                         target2.x() - target1.x());
        angle = atarget - abase;
        //end, rotate selection
        for (int i = 0; i < obj.size(); ++i) {
			obj.at(i)->moveRotate(movev, target1, angle);
        }

    }

//selection cleanup
    while (!obj.isEmpty())
        delete obj.takeFirst();
}
开发者ID:Aly1029,项目名称:LibreCAD,代码行数:42,代码来源:align.cpp

示例7: getPageRank

int HistoryManager::getPageRank(const QString &url)
{
 //Check for a valid entry
    if (url.isNull())
        return 0;

    int rank = 0;
	QList<HistoryLeaf*> historyNodes = d->m_historySession->fetchHistory();

    for (int i=0; i < historyNodes.count(); i++) {
      //Update rank if there is a history for this URL.
        if (!historyNodes[i]->getUrl().compare(url))
           rank++;
    }

	while (!historyNodes.isEmpty())
     delete historyNodes.takeFirst();

    return rank;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:20,代码来源:HistoryManager.cpp

示例8: attackPhase

void RiskAI_TitanNet::attackPhase()
{
	QList<RiskMapLand *> willAttack;
	
	eval->filterOnlyPlayer( player->getPlayerId() );
	eval->addFilterHasEnemyNeighbor();
	eval->addFilterHasMoreThanXArmys( 1 );
	willAttack = eval->getFilteredList();

	if( eval->addFilterHasMoreThanXArmys( 3 ) > 0 )
	{
		willAttack = eval->getFilteredList();
	}

	while( !willAttack.isEmpty() )
	{
		RiskMapLand *newAttack = attackFrom( willAttack.takeFirst() );
		if( newAttack != NULL ) willAttack.append( newAttack );
	}
}
开发者ID:sven001,项目名称:RisikoAI,代码行数:20,代码来源:RiskAI_TitanNet.cpp

示例9: checkUndoLimit

bool QtUndoStackPrivate::checkUndoLimit()
{
    if (undo_limit <= 0 || !macro_stack.isEmpty() || undo_limit >= command_list.count())
        return false;

    int del_count = command_list.count() - undo_limit;

    for (int i = 0; i < del_count; ++i)
        delete command_list.takeFirst();

    index -= del_count;
    if (clean_index != -1) {
        if (clean_index < del_count)
            clean_index = -1; // we've deleted the clean command
        else
            clean_index -= del_count;
    }

    return true;
}
开发者ID:alinelena,项目名称:quill,代码行数:20,代码来源:qtundostack.cpp

示例10: findSnapshotIdsRecursively

static QList<qint64> findSnapshotIdsRecursively(QScriptDebuggerLocalsModelNode *root)
{
    QList<qint64> result;
    if (root->snapshotId == -1) {
        Q_ASSERT(root->children.isEmpty());
        return result;
    }
    QList<QScriptDebuggerLocalsModelNode*> nodeStack;
    nodeStack.append(root);
    while (!nodeStack.isEmpty()) {
        QScriptDebuggerLocalsModelNode *node = nodeStack.takeFirst();
        result.append(node->snapshotId);
        for (int i = 0; i < node->children.count(); ++i) {
            QScriptDebuggerLocalsModelNode *child = node->children.at(i);
            if (child->snapshotId != -1)
                nodeStack.prepend(child);
        }
    }
    return result;
}
开发者ID:phen89,项目名称:rtqt,代码行数:20,代码来源:qscriptdebuggerlocalsmodel.cpp

示例11: SetItemTags

	void ItemsFilterModel::SetItemTags (QList<ITagsManager::tag_id> tags)
	{
		if (tags.isEmpty ())
			TaggedItems_.clear ();
		else
		{
			const auto& sb = StorageBackendManager::Instance ().MakeStorageBackendForThread ();
			TaggedItems_ = QSet<IDType_t>::fromList (sb->GetItemsForTag (tags.takeFirst ()));

			for (const auto& tag : tags)
			{
				const auto& set = QSet<IDType_t>::fromList (sb->GetItemsForTag (tag));
				TaggedItems_.intersect (set);
				if (TaggedItems_.isEmpty ())
					TaggedItems_ << -1;
			}
		}

		invalidate ();
	}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例12: handleUnsupportedContent

void WebPage::handleUnsupportedContent(QNetworkReply *reply)
{
    if (reply->error() == QNetworkReply::NoError) {
        BrowserApplication::downloadManager()->handleUnsupportedContent(reply);
        return;
    }

    QFile file(QLatin1String(":/notfound.html"));
    bool isOpened = file.open(QIODevice::ReadOnly);
    Q_ASSERT(isOpened);
    QString title = tr("Error loading page: %1").arg(reply->url().toString());
    QString html = QString(QLatin1String(file.readAll()))
                        .arg(title)
                        .arg(reply->errorString())
                        .arg(reply->url().toString());

    QBuffer imageBuffer;
    imageBuffer.open(QBuffer::ReadWrite);
    QIcon icon = view()->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, view());
    QPixmap pixmap = icon.pixmap(QSize(32, 32));
    if (pixmap.save(&imageBuffer, "PNG")) {
        html.replace(QLatin1String("IMAGE_BINARY_DATA_HERE"),
                     QString(QLatin1String(imageBuffer.buffer().toBase64())));
    }

    QList<QWebFrame*> frames;
    frames.append(mainFrame());
    while (!frames.isEmpty()) {
        QWebFrame *frame = frames.takeFirst();
        if (frame->url() == reply->url()) {
            frame->setHtml(html, reply->url());
            return;
        }
        QList<QWebFrame *> children = frame->childFrames();
        foreach(QWebFrame *frame, children)
            frames.append(frame);
    }
    if (m_loadingUrl == reply->url()) {
        mainFrame()->setHtml(html, reply->url());
    }
}
开发者ID:daniel-kun,项目名称:arora,代码行数:41,代码来源:webview.cpp

示例13: testMySqlTransactionCommit

void SqlTransactionTests::testMySqlTransactionCommit()
{
    MySqlStorage storage = prepareMySqlStorage();
    QVERIFY( storage.database().open() );

    QList<Task> tasksBefore = storage.getAllTasks();
    QVERIFY( ! tasksBefore.isEmpty() );
    Task first = tasksBefore.takeFirst();
    // test a simple transaction that is completed and committed:
    {
        SqlRaiiTransactor transactor( storage.database() );
        QSqlQuery query( storage.database() );
        query.prepare("DELETE from Tasks where id=:id");
        query.bindValue( "id", first.id() );
        QVERIFY( storage.runQuery( query ) );
        transactor.commit();
    } // this transaction WAS commited
    QList<Task> tasksAfter = storage.getAllTasks();
    QVERIFY( ! tasksAfter.isEmpty() );
    QVERIFY( tasksBefore == tasksAfter );
}
开发者ID:NicholasVanSickle,项目名称:Charm,代码行数:21,代码来源:SqlTransactionTests.cpp

示例14: addFilterHasNoEnemyNeighbor

int RiskMapEvaluator::addFilterHasNoEnemyNeighbor()
{
	QList<RiskMapLand*> list;
	for( int i = filtered.size()-1; i>=0; i-- )
	{
		list = filtered[i]->getNeighbors();
		bool takeIt = true;
		while( !list.isEmpty() )
		{
			if( list.takeFirst()->getOwner() != filtered[i]->getOwner() )
			{
				takeIt = false;
			}
		}
		if( !takeIt )
		{
			filtered.takeAt( i );
		}
	}
	return( filtered.size() );
}
开发者ID:sven001,项目名称:RisikoAI,代码行数:21,代码来源:RiskMapEvaluator.cpp

示例15: setShortcuts

/*!
    \since 4.2

    Sets \a shortcuts as the list of shortcuts that trigger the
    action. The first element of the list is the primary shortcut.

    \sa shortcut
*/
void QAction::setShortcuts(const QList<QKeySequence> &shortcuts)
{
    Q_D(QAction);

    QList <QKeySequence> listCopy = shortcuts;

    QKeySequence primary;
    if (!listCopy.isEmpty())
        primary = listCopy.takeFirst();

    if (d->shortcut == primary && d->alternateShortcuts == listCopy)
        return;

    QAPP_CHECK("setShortcuts");

    d->shortcut = primary;
    d->alternateShortcuts = listCopy;
    d->redoGrab(qApp->d_func()->shortcutMap);
    d->redoGrabAlternate(qApp->d_func()->shortcutMap);
    d->sendDataChanged();
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:29,代码来源:qaction.cpp


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