本文整理汇总了C++中QLinkedList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::count方法的具体用法?C++ QLinkedList::count怎么用?C++ QLinkedList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QLinkedList<QString> linkList;
linkList.append("Bangaluru");
linkList.append("Mumbai");
linkList.append("Delhi");
linkList.append("Gandhinagara");
qDebug() << "1-Number of Items =" << linkList.count();
QLinkedList<QString>::iterator j = qFind(linkList.begin(),linkList.end(),"Varanasi");
linkList.insert(j,"Bhopal");
QLinkedList<QString>::iterator i;
for (i = linkList.begin(); i != linkList.end(); ++i)
qDebug() << *i << endl;
qDebug() << "2-Number of Items =" << linkList.count();
return a.exec();
}
示例2: run
void SendDataThread::run()
{
while(true)
{
QMutexLocker locker(&m_DataMutex);
m_DataCondition.wait(&m_DataMutex);
int count = m_DataList.count();
for(int i = 0; i < count; ++i)
{
const QByteArray& data = m_DataList.first();
if(!::sendData(m_Socket, data.data(), data.size()))
{
qDebug()<<"Send data to server error";
return;
}
m_DataList.pop_front();
}
}
}
示例3: joinConnectedFeatures
void Layer::joinConnectedFeatures()
{
// go through all label texts
int connectedFeaturesId = 0;
Q_FOREACH ( const QString& labelText, mConnectedTexts )
{
if ( !mConnectedHashtable.contains( labelText ) )
continue; // shouldn't happen
connectedFeaturesId++;
QLinkedList<FeaturePart*>* parts = mConnectedHashtable.value( labelText );
// go one-by-one part, try to merge
while ( !parts->isEmpty() && parts->count() > 1 )
{
// part we'll be checking against other in this round
FeaturePart* partCheck = parts->takeFirst();
FeaturePart* otherPart = _findConnectedPart( partCheck, parts );
if ( otherPart )
{
// remove partCheck from r-tree
double checkpartBMin[2], checkpartBMax[2];
partCheck->getBoundingBox( checkpartBMin, checkpartBMax );
double otherPartBMin[2], otherPartBMax[2];
otherPart->getBoundingBox( otherPartBMin, otherPartBMax );
// merge points from partCheck to p->item
if ( otherPart->mergeWithFeaturePart( partCheck ) )
{
// remove the parts we are joining from the index
mFeatureIndex->Remove( checkpartBMin, checkpartBMax, partCheck );
mFeatureIndex->Remove( otherPartBMin, otherPartBMax, otherPart );
// reinsert merged line to r-tree (probably not needed)
otherPart->getBoundingBox( otherPartBMin, otherPartBMax );
mFeatureIndex->Insert( otherPartBMin, otherPartBMax, otherPart );
mConnectedFeaturesIds.insert( partCheck->featureId(), connectedFeaturesId );
mConnectedFeaturesIds.insert( otherPart->featureId(), connectedFeaturesId );
mFeatureParts.removeOne( partCheck );
delete partCheck;
}
}
}
// we're done processing feature parts with this particular label text
delete parts;
mConnectedHashtable.remove( labelText );
}
// we're done processing connected features
//should be empty, but clear to be safe
qDeleteAll( mConnectedHashtable );
mConnectedHashtable.clear();
mConnectedTexts.clear();
}
示例4: undo
void CmdCreateTransition::undo() {
QLinkedList<Item*> items = mPetriNet->removeItem(mId);
Q_ASSERT(items.count() == 1);
qDeleteAll(items);
}