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


C++ Q3PtrList::setAutoDelete方法代码示例

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


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

示例1: getSINWAV

PlotLine * SINWAV::calculateCustom (QString &, Q3PtrList<PlotLine> &)
{
  Q3PtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getSINWAV(pll);
  pll.remove(1);
  return pll.at(0);
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:8,代码来源:SINWAV.cpp

示例2: 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);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:36,代码来源:tst_q3ptrlist.cpp

示例3: QCOMPARE

void tst_Q3PtrList::replace()
{
    Q3PtrList<int> list;
    int foo = 4;
    list.setAutoDelete( TRUE );
    QCOMPARE( list.insert(0, new int(1)), (bool)TRUE );
    QCOMPARE( list.insert(1, new int(2)), (bool)TRUE );
    QCOMPARE( list.insert(2, new int(4)), (bool)TRUE );

    QCOMPARE( *(list.at(2)), 4 );
    QCOMPARE( list.replace(2, new int(3)), (bool)TRUE );
    QCOMPARE( *(list.at(2)), 3 );
    uint count = list.count();
    QCOMPARE( list.replace(3, &foo), (bool)FALSE );
    QCOMPARE( list.count(), count );

    int *p = new int(7);
    QCOMPARE( list.insert(2, p), (bool)TRUE );
    QCOMPARE( list.replace(2, p), (bool)TRUE );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:20,代码来源:tst_q3ptrlist.cpp

示例4: qDebug

Q3PtrList<Q3NetworkOperation> Q3UrlOperator::copy( const QString &from, const QString &to, bool move, bool toPath )
{
#ifdef Q3URLOPERATOR_DEBUG
    qDebug( "Q3UrlOperator: copy %s %s %d", from.latin1(), to.latin1(), move );
#endif

    Q3PtrList<Q3NetworkOperation> ops;
    ops.setAutoDelete( false );

    Q3UrlOperator *uFrom = new Q3UrlOperator( *this, from );
    Q3UrlOperator *uTo = new Q3UrlOperator( to );

    // prepare some string for later usage
    QString frm = *uFrom;
    QString file = uFrom->fileName();

    if (frm == to + file)
         return ops;
    
    file.prepend( QLatin1String("/") );

    // uFrom and uTo are deleted when the Q3NetworkProtocol deletes itself via
    // autodelete
    uFrom->getNetworkProtocol();
    uTo->getNetworkProtocol();
    Q3NetworkProtocol *gProt = uFrom->d->networkProtocol;
    Q3NetworkProtocol *pProt = uTo->d->networkProtocol;

    uFrom->setPath( uFrom->dirPath() );

    if ( gProt && (gProt->supportedOperations()&Q3NetworkProtocol::OpGet) &&
	 pProt && (pProt->supportedOperations()&Q3NetworkProtocol::OpPut) ) {

	connect( gProt, SIGNAL(data(QByteArray,Q3NetworkOperation*)),
		 this, SLOT(copyGotData(QByteArray,Q3NetworkOperation*)) );
	connect( gProt, SIGNAL(dataTransferProgress(int,int,Q3NetworkOperation*)),
		 this, SIGNAL(dataTransferProgress(int,int,Q3NetworkOperation*)) );
	connect( gProt, SIGNAL(finished(Q3NetworkOperation*)),
		 this, SLOT(continueCopy(Q3NetworkOperation*)) );
	connect( gProt, SIGNAL(finished(Q3NetworkOperation*)),
		 this, SIGNAL(finished(Q3NetworkOperation*)) );
	connect( gProt, SIGNAL(connectionStateChanged(int,QString)),
		 this, SIGNAL(connectionStateChanged(int,QString)) );

	connect( pProt, SIGNAL(dataTransferProgress(int,int,Q3NetworkOperation*)),
		 this, SIGNAL(dataTransferProgress(int,int,Q3NetworkOperation*)) );
	connect( pProt, SIGNAL(finished(Q3NetworkOperation*)),
		 this, SIGNAL(finished(Q3NetworkOperation*)) );
	connect( pProt, SIGNAL(finished(Q3NetworkOperation*)),
		 this, SLOT(finishedCopy()) );

	Q3NetworkOperation *opGet = new Q3NetworkOperation( Q3NetworkProtocol::OpGet, frm, QString(), QString() );
	ops.append( opGet );
	gProt->addOperation( opGet );


	QString toFile = to + file;
	if (!toPath)
	    toFile = to;

	Q3NetworkOperation *opPut = new Q3NetworkOperation( Q3NetworkProtocol::OpPut, toFile, QString(), QString() );
	ops.append( opPut );

	d->getOpPutProtMap.insert( (void*)opGet, pProt );
	d->getOpGetProtMap.insert( (void*)opGet, gProt );
	d->getOpPutOpMap.insert( (void*)opGet, opPut );

	if ( move && (gProt->supportedOperations()&Q3NetworkProtocol::OpRemove) ) {
	    gProt->setAutoDelete( false );

	    Q3NetworkOperation *opRm = new Q3NetworkOperation( Q3NetworkProtocol::OpRemove, frm, QString(), QString() );
	    ops.append( opRm );
	    d->getOpRemoveOpMap.insert( (void*)opGet, opRm );
	} else {
	    gProt->setAutoDelete( true );
	}
#ifdef Q3URLOPERATOR_DEBUG
	qDebug( "Q3UrlOperator: copy operation should start now..." );
#endif
	return ops;
    } else {
开发者ID:FilipBE,项目名称:qtextended,代码行数:81,代码来源:q3urloperator.cpp


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