本文整理汇总了C++中Q3PtrList::current方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrList::current方法的具体用法?C++ Q3PtrList::current怎么用?C++ Q3PtrList::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3PtrList
的用法示例。
在下文中一共展示了Q3PtrList::current方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
void tst_Q3PtrList::removeType()
{
Q3PtrList<QString> items;
items.append(new QString("first"));
QString *second = new QString("second");
items.append(second);
QString *third = new QString("third");
items.append(third);
QString *fourth = new QString("fourth");
items.append(fourth);
QVERIFY(items.current() == fourth);
items.setAutoDelete(FALSE);
// this test an undocumented feature of remove( NULL )
// in QGList::remove if the ptr is 0 it removes the current item
// ie. it removes the fourth item from the list in this case
QString *nullPointer = NULL;
items.remove( nullPointer );
QVERIFY(items.count() == 3);
QVERIFY(items.current() == third);
// this tests that remove updates the current item also
// when it removes the _end_ item in the list
items.remove(third);
QVERIFY(items.current() == second);
// test that the removed items are not in the list, then deletes them
QVERIFY(third && items.find(third) == -1 );
QVERIFY(fourth && items.find(fourth) == -1);
delete third;
delete fourth;
fourth = third = 0;
items.setAutoDelete(TRUE);
}