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


C++ QPtrList::isEmpty方法代码示例

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


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

示例1: load

/**
 * Load settings from file
 */
void Settings::load()
{
	// Search for a file from user's home directory
	QString path = QString(getenv("HOME")) +
		QString("/") + QString(KQLCUserDir);

	QString fileName = path + QString("/") + QString(KConfigFile);
	QPtrList <QString> list;

	if (FileHandler::readFileToList(fileName, list) == true)
	{
		for (QString* s = list.first(); s != NULL; s = list.next())
		{
			if (*s == QString("Entry"))
			{
				if (*(list.next()) == QString("General"))
				{
					createContents(list);
				}
			}
		}
	}

	while (!list.isEmpty())
	{
		delete list.take(0);
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:31,代码来源:settings.cpp

示例2: slotAboutToShow

void KPrintAction::slotAboutToShow()
{
	popupMenu()->clear();
	d->printers.clear();
	QPtrList<KMPrinter>	*prts = KMManager::self()->printerList();
	if (prts && !prts->isEmpty())
	{
		QPtrListIterator<KMPrinter>	it(*prts);
		bool	first(false);
		int	ID(0);
		for (; it.current(); ++it)
		{
			if (d->type == All || (d->type == Specials && it.current()->isSpecial()) || (d->type == Regular && !it.current()->isSpecial()))
			{
				if (d->type == All && !first && it.current()->isSpecial())
				{
					if (popupMenu()->count() > 0)
						popupMenu()->insertSeparator();
					first = true;
				}
				popupMenu()->insertItem(SmallIconSet(it.current()->pixmap()), it.current()->name(), ID++);
				d->printers.append(it.current()->name());
			}
		}
	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3: saveSelectedBodyParts

//-----------------------------------------------------------------------------
void KMMimePartTree::saveSelectedBodyParts( bool encoded )
{
  QPtrList<QListViewItem> selected = selectedItems();

  Q_ASSERT( !selected.isEmpty() );
  if ( selected.isEmpty() )
    return;

  QPtrListIterator<QListViewItem> it( selected );
  QPtrList<partNode> parts;
  while ( it.current() ) {
    parts.append( static_cast<KMMimePartTreeItem *>(it.current())->node() );
    ++it;
  }
  mReaderWin->setUpdateAttachment();
  KMSaveAttachmentsCommand *command =
    new KMSaveAttachmentsCommand( this, parts, mReaderWin->message(), encoded );
  command->start();
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例4: slotShowLinks

void KGet_plug_in::slotShowLinks()
{
    if ( !parent() || !parent()->inherits( "KHTMLPart" ) )
        return;

    KHTMLPart *htmlPart = static_cast<KHTMLPart*>( parent() );
    KParts::Part *activePart = 0L;
    if ( htmlPart->partManager() )
    {
        activePart = htmlPart->partManager()->activePart();
        if ( activePart && activePart->inherits( "KHTMLPart" ) )
            htmlPart = static_cast<KHTMLPart*>( activePart );
    }

    DOM::HTMLDocument doc = htmlPart->htmlDocument();
    if ( doc.isNull() )
        return;

    DOM::HTMLCollection links = doc.links();

    QPtrList<LinkItem> linkList;
    std::set<QString> dupeCheck;
    for ( uint i = 0; i < links.length(); i++ )
    {
        DOM::Node link = links.item( i );
        if ( link.isNull() || link.nodeType() != DOM::Node::ELEMENT_NODE )
            continue;

        LinkItem *item = new LinkItem( (DOM::Element) link );
        if ( item->isValid() &&
             dupeCheck.find( item->url.url() ) == dupeCheck.end() )
        {
            linkList.append( item );
            dupeCheck.insert( item->url.url() );
        }
        else
            delete item;
    }

    if ( linkList.isEmpty() )
    {
        KMessageBox::sorry( htmlPart->widget(),
            i18n("There are no links in the active frame of the current HTML page."),
            i18n("No Links") );
        return;
    }

    KGetLinkView *view = new KGetLinkView();
    QString url = doc.URL().string();
    view->setPageURL( url );

    view->setLinks( linkList );
    view->show();
}
开发者ID:woodyplus,项目名称:kde3-kdenetwork,代码行数:54,代码来源:kget_plug_in.cpp

示例5: it

void K3bMovixView::slotRemoveSubTitleItems()
{
  QPtrList<QListViewItem> list = m_listView->selectedItems();
  QPtrListIterator<QListViewItem> it(list);

  if( list.isEmpty() )
    kdDebug() << "nothing to remove" << endl;

  for( ; it.current(); ++it ) {
    K3bMovixListViewItem* vi = static_cast<K3bMovixListViewItem*>(*it);
    m_doc->removeSubTitleItem( vi->fileItem() );
  }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: registerSocketNotifier

/*****************************************************************************
 QEventLoop implementations for UNIX
 *****************************************************************************/
void QEventLoop::registerSocketNotifier( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    if ( sockfd < 0 || sockfd >= FD_SETSIZE || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QSocketNotifier: Internal error" );
#endif
	return;
    }

    QPtrList<QSockNot>  *list = d->sn_vec[type].list;
    fd_set *fds  = &d->sn_vec[type].enabled_fds;
    QSockNot *sn;

    if ( ! list ) {
	// create new list, the QSockNotType destructor will delete it for us
	list = new QPtrList<QSockNot>;
	Q_CHECK_PTR( list );
	list->setAutoDelete( TRUE );
	d->sn_vec[type].list = list;
    }

    sn = new QSockNot;
    Q_CHECK_PTR( sn );
    sn->obj = notifier;
    sn->fd = sockfd;
    sn->queue = &d->sn_vec[type].pending_fds;

    if ( list->isEmpty() ) {
	list->insert( 0, sn );
    } else {				// sort list by fd, decreasing
	QSockNot *p = list->first();
	while ( p && p->fd > sockfd )
	    p = list->next();
#if defined(QT_CHECK_STATE)
	if ( p && p->fd == sockfd ) {
	    static const char *t[] = { "read", "write", "exception" };
	    qWarning( "QSocketNotifier: Multiple socket notifiers for "
		      "same socket %d and type %s", sockfd, t[type] );
	}
#endif
	if ( p )
	    list->insert( list->at(), sn );
	else
	    list->append( sn );
    }

    FD_SET( sockfd, fds );
    d->sn_highest = QMAX( d->sn_highest, sockfd );
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:54,代码来源:qeventloop_unix.cpp

示例7: initDeviceClasses

////////////////////////
// Device Class stuff //
////////////////////////
//
// Read all device classes from files
//
void App::initDeviceClasses()
{
  DeviceClass* dc = NULL;
  QString path = QString::null;

  QString dir;
  settings()->get(KEY_SYSTEM_DIR, dir);
  dir += QString("/") + DEVICECLASSPATH + QString("/");

  QDir d(dir);
  d.setFilter(QDir::Files);
  d.setNameFilter("*.deviceclass");
  if (d.exists() == false || d.isReadable() == false)
    {
      QString msg("Unable to read from device directory!");
      QMessageBox::warning(this, KApplicationNameShort, msg);

      return;
    }

  QStringList dirlist(d.entryList());
  QStringList::Iterator it;

  QPtrList <QString> list; // Our stringlist that contains the files' contents

  // Put a slash to the end of the directory name if it isn't there
  if (dir.right(1) != QString("/"))
    {
      dir = dir + QString("/");
    }

  // Go thru all files
  for (it = dirlist.begin(); it != dirlist.end(); ++it)
    {
      path = dir + *it;
      FileHandler::readFileToList(path, list);
      dc = DeviceClass::createDeviceClass(list);
      if (dc != NULL)
	{
	  addDeviceClass(dc);
	}

      // The list needs to be cleared between files
      while (list.isEmpty() == false)
	{
	  list.first();
	  delete list.take();
	}
    }
}
开发者ID:speakman,项目名称:qlc,代码行数:56,代码来源:app.cpp

示例8: ungetch

/*!
    Prepends the character \a ch to the read buffer so that the next
    read returns this character as the first character of the output.

	\sa getch()
*/
int cAsyncNetIOPrivate::ungetch( int ch )
{
    if ( rba.isEmpty() || rindex==0 ) {
		// we need a new QByteArray
		QByteArray *ba = new QByteArray( 1 );
		rba.insert( 0, ba );
		rsize++;
		ba->at( 0 ) = ch;
    } else {
		// we can reuse a place in the buffer
		QByteArray *ba = rba.first();
		rindex--;
		rsize++;
		ba->at( rindex ) = ch;
    }
    return ch;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:23,代码来源:asyncnetio.cpp

示例9: tryLookup

bool tryLookup(const char *node, const char *serv)
{
    int error;
    QString _node = QString::fromLatin1(node);
    QString _serv = QString::fromLatin1(serv);

    printf("\tTrying to lookup %s|%s... ", node, serv);
    QPtrList< KAddressInfo > list = KExtendedSocket::lookup(_node, _serv, 0, &error);
    list.setAutoDelete(true);
    if(!list.isEmpty())
    {
        printf("worked\n");
        return true;
    }

    printf("failed\n\tReason was: %s\n", (const char *)KExtendedSocket::strError(IO_LookupError, error).local8Bit());
    return false;
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:18,代码来源:kresolvertest.cpp

示例10: KActionMenu

KActionMenu *JabberTransport::actionMenu ()
{
	KActionMenu *menu = new KActionMenu( accountId(), myself()->onlineStatus().iconFor( this ),  this );
	QString nick = myself()->property( Kopete::Global::Properties::self()->nickName()).value().toString();

	menu->popupMenu()->insertTitle( myself()->onlineStatus().iconFor( myself() ),
	nick.isNull() ? accountLabel() : i18n( "%2 <%1>" ).arg( accountLabel(), nick )
								  );
	
	QPtrList<KAction> *customActions = myself()->customContextMenuActions(  );
	if( customActions && !customActions->isEmpty() )
	{
		menu->popupMenu()->insertSeparator();

		for( KAction *a = customActions->first(); a; a = customActions->next() )
			a->plug( menu->popupMenu() );
	}
	delete customActions;

	return menu;

/*	KActionMenu *m_actionMenu = Kopete::Account::actionMenu();

	m_actionMenu->popupMenu()->insertSeparator();

	m_actionMenu->insert(new KAction (i18n ("Join Groupchat..."), "jabber_group", 0,
		this, SLOT (slotJoinNewChat ()), this, "actionJoinChat"));

	m_actionMenu->popupMenu()->insertSeparator();

	m_actionMenu->insert ( new KAction ( i18n ("Services..."), "jabber_serv_on", 0,
										 this, SLOT ( slotGetServices () ), this, "actionJabberServices") );

	m_actionMenu->insert ( new KAction ( i18n ("Send Raw Packet to Server..."), "mail_new", 0,
										 this, SLOT ( slotSendRaw () ), this, "actionJabberSendRaw") );

	m_actionMenu->insert ( new KAction ( i18n ("Edit User Info..."), "identity", 0,
										 this, SLOT ( slotEditVCard () ), this, "actionEditVCard") );

	return m_actionMenu;*/
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:41,代码来源:jabbertransport.cpp

示例11: invokeDMXValueMenu

/**
 * Display a DMX value menu, divided into submenus of 16 values
 */
int VCXYPadProperties::invokeDMXValueMenu(const QPoint &point)
{
    int result;

    QPopupMenu* menu = new QPopupMenu;
    QPtrList <QPopupMenu> deleteList;

    menu->insertItem("Value", KNoID);
    menu->insertSeparator();

    menu->insertItem(QString::number(KChannelValueMin), KChannelValueMin);
    menu->insertItem(QString::number(KChannelValueMax), KChannelValueMax);
    for (t_value i = 0; i != KChannelValueMax; i += 15)
    {
        QPopupMenu* sub = new QPopupMenu();
        deleteList.append(sub);

        QString top;
        top.sprintf("%d - %d", i+1, i + 15);

        for (t_value j = 1; j < 16; j++)
        {
            QString num;
            num.setNum(i + j);
            sub->insertItem(num, i + j);
        }

        menu->insertItem(top, sub);
    }

    result = menu->exec(point);

    while (deleteList.isEmpty() == false)
    {
        delete deleteList.take(0);
    }

    delete menu;

    return result;
}
开发者ID:speakman,项目名称:qlc,代码行数:44,代码来源:vcxypadproperties.cpp

示例12: Draw

void UIListBtnType::Draw(QPainter *p, int order, int context, bool active_on)
{
    if (!m_visible || hidden)
        return;

    if (!m_initialized)
        Init();

    if (m_order != order)
        return;

    if (m_context != -1 && m_context != context)
        return;

    //  Put something on the LCD device (if one exists)
    if (class LCD *lcddev = LCD::Get())
    {
        if (m_active)
        {
            // add max of lcd height menu items either side of the selected item
            // let the lcdserver figure out which ones to display

            QPtrList<LCDMenuItem> menuItems;
            menuItems.setAutoDelete(true);

            QPtrListIterator<UIListBtnTypeItem> it = (*m_selIterator);
            uint count = 0;

            // move back up the list a little
            while (it.current() && count < lcddev->getLCDHeight())
            {
                --it;
                ++count;
            }

            if (!it.current())
                it.toFirst();
            count = 0;
            while (it.current() && count < lcddev->getLCDHeight() * 2)
            {
                UIListBtnTypeItem *curItem = it.current();
                QString msg = curItem->text();
                bool selected;
                CHECKED_STATE checkState = NOTCHECKABLE;
                if (curItem->checkable())
                {
                    if (curItem->state() == UIListBtnTypeItem::HalfChecked || 
                        curItem->state() == UIListBtnTypeItem::FullChecked)
                        checkState = CHECKED;
                    else
                        checkState = UNCHECKED;
                }

                if (curItem == m_selItem)
                    selected = true;
                else
                    selected = false;

                menuItems.append(new LCDMenuItem(selected, checkState, msg));
                ++it;
                ++count;
            }

            QString title = "";

            if (m_parentListTree && m_parentListTree->getDepth() > 0)
                title = "<< ";
            else
                title = "   ";

            if ((m_selItem && m_selItem->getDrawArrow()) || m_showArrow)
                title += " >>";
            else
                title += "   ";

            if (!menuItems.isEmpty())
            {
                lcddev->switchToMenu(&menuItems, title);
            }
        }
    }

    fontProp* font = m_active ? m_fontActive : m_fontInactive;

    if (!active_on)
    {
        font = m_fontInactive;
    }
    
    p->setFont(font->face);
    p->setPen(font->color);

    int x = m_rect.x() + m_xdrawoffset;

    int y = m_rect.y();
    QPtrListIterator<UIListBtnTypeItem> it = (*m_topIterator);
    while (it.current() && 
           (y - m_rect.y()) <= (m_contentsRect.height() - m_itemHeight)) 
    {
        if (active_on && it.current()->getOverrideInactive())
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例13: registerSocketNotifier

/*****************************************************************************
 QEventLoopEx implementations for Windows (for synchronous socket calls)
 *****************************************************************************/
void QEventLoopEx::registerSocketNotifier( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    u_long	n;
    DWORD dw;
#ifdef _DEBUG_EVENTLOOPEX
    qDebug( "QSocketNotifier::registerSocketNotifier %p", notifier );
#endif
    if(ioctlsocket(sockfd,FIONREAD,&n) == SOCKET_ERROR)
    {
#ifdef _DEBUG_EVENTLOOPEX
        qDebug( "QSocketNotifier::registerSocketNotifier %p not a socket", notifier );
#endif
        dw = WSAGetLastError();
        QEventLoop::registerSocketNotifier(notifier);
        return;
    }

    if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 )
    {
#if defined(QT_CHECK_RANGE)
        qWarning( "QSocketNotifier: Internal error" );
#endif
        return;
    }

    EnterCriticalSection(&d->m_csVec);

    QPtrList<QSockNotEx>  *list = d->sn_vec[type].list;
    fd_set *fds  = &d->sn_vec[type].enabled_fds;
    QSockNotEx *sn;

    if ( ! list ) {
        // create new list, the QSockNotType destructor will delete it for us
        list = new QPtrList<QSockNotEx>;
        Q_CHECK_PTR( list );
        list->setAutoDelete( TRUE );
        d->sn_vec[type].list = list;
    }

    sn = new QSockNotEx;
    Q_CHECK_PTR( sn );
    sn->obj = notifier;
    sn->fd = sockfd;
    sn->queue = &d->sn_vec[type].pending_fds;

    if ( list->isEmpty() ) {
        list->insert( 0, sn );
    } else { // sort list by fd, decreasing
        QSockNotEx *p = list->first();
        while ( p && p->fd > sockfd )
            p = list->next();
        if ( p )
            list->insert( list->at(), sn );
        else
            list->append( sn );
    }

    FD_SET( sockfd, fds );

    d->sn_highest = QMAX( d->sn_highest, sockfd );
    LeaveCriticalSection(&d->m_csVec);

#ifdef _DEBUG_EVENTLOOPEX
    qDebug( "QSocketNotifier::signal update socket");
#endif
    closesocket(d->m_sockUpdate);
}
开发者ID:,项目名称:,代码行数:72,代码来源:

示例14: doExport


//.........这里部分代码省略.........
		keysig = new NKeySig(0, 0);
	}
	timesig = voice_elem->getFirstTimeSig();
	if (!timesig) {
		timesig = new NTimeSig(0, &NResource::nullprops_);
		timesig->setSignature(4, 4);
	}
	countof128th_ = timesig->numOf128th();
	mStaffInf_ = new NMultistaffInfo(mainWidget_, staffList_, staffList_->count());
	if (mStaffInf_->hasDisconnectedPianoBars()) {
		bad = new badmeasure(PMX_ERR_DISCONT_PIANO, 1 /*dummy */, 0 /* dummy */, 3 /*dummy */,  128 /*dummy */);
		badlist_.append(bad);
	}

	
	out_ << "%-----------------------------------------%" << endl;
	out_ << "%                                         %" << endl;
	out_ << "% PMX output generated by \"NoteEdit\"    %" << endl;
	out_ << "%                                         %" << endl;
	out_ << "%-----------------------------------------%" << endl;
	if (pmxOpts_.mLyr) {
		out_ << "---" << endl;
		out_ << "\\input musixtex" << endl;
		out_ << "\\input pmx" << endl;
		out_ << "\\input musixlyr" << endl << endl;
		lyrNames.setAutoDelete(true);
		for (i = 0, staff_elem = staffList_->first(); staff_elem; staff_elem = staffList_->next(), i++) {
			if (!NResource::staffSelExport_[i]) continue;
			voice_elem = staff_elem->getVoiceNr(0);
			if (!(count_of_lyrics = voice_elem->countOfLyricsLines())) continue;
			voice_elem->collectLyrics(lyricslist);
			lyrNames.clear();
			for (j = 0; j < NUM_LYRICS; j++) {
				if (!lyricslist[j].isEmpty()) {
					lyrName = new QString();
					if (count_of_lyrics < 2) {
						lyrName->sprintf("lyrstaff%d", staffsToExport_ - i);
					}
					else {
						lyrName->sprintf("lyrstaff%dverse%d", staffsToExport_ - i, j+1);
					}
					lyrNames.append(lyrName);
					out_ << "\\setlyrics{" << (*lyrName) << "}{" << lyrics2TeX(&(lyricslist[j])) << "}" << endl;
				}
			}
	
			out_ << "\\assignlyrics{" << (staffsToExport_ - i) << "}{";
			while(!lyrNames.isEmpty()) {
				out_ << *(lyrNames.first());
				lyrNames.remove();
				if (!lyrNames.isEmpty()) out_ << ',';
			}
			out_ << '}' << endl << endl;
		}
		out_ << "---" << endl;
	}
/*
	out_ << "---" << endl;
	out_ << "\\def\\mtxInterInstrument#1#2{\\setinterinstrument{#1}{#2\\Interligne}}" << endl;
	out_ << "\\def\\mtxStaffBottom#1{\\staffbotmarg #1\\Interligne}" << endl;
	out_ << "---" << endl << endl;
*/

	out_ << "% nv,noinst,mtrnuml,mtrdenl,mtrnump,mtrdenp,xmtrnum0,isig," << endl;
	out_ << "   " << staffsToExport_ << "    ";
	if (staffsToExport_ == mStaffInf_->getMultiStaffCount()) {
开发者ID:BackupTheBerlios,项目名称:noteedit-svn,代码行数:67,代码来源:pmxexport.cpp

示例15: canInsert

int PMInsertRuleSystem::canInsert( const PMObject* parentObject,
                                   const QStringList& list,
                                   const PMObject* after )
{
   if( list.size( ) == 1 )
   {
      // more efficient
      if( canInsert( parentObject, list.first( ), after ) )
         return 1;
      else
         return 0;
   }

   // find rules for target class
   QPtrList<PMRuleTargetClass> targetClassList;
   PMMetaObject* meta = parentObject->metaObject( );
   for( ; meta; meta = meta->superClass( ) )
   {
      PMRuleTargetClass* tc = m_rulesDict.find( meta->className( ) );
      if( tc )
         targetClassList.append( tc );
   }
   if( targetClassList.isEmpty( ) )
      return 0; // not rules found

   // count already inserted children
   QPtrListIterator<PMRuleTargetClass> tit( targetClassList );
   for( ; tit.current( ); ++tit ) // ... for all target classes
   {
      QPtrListIterator<PMRule> rit = tit.current( )->rules( );
      for( ; rit.current( ); ++rit ) // ... and all rules
      {
         rit.current( )->reset( );
         bool afterInsertPoint = false;
         PMObject* o = parentObject->firstChild( );
         if( !after )
            afterInsertPoint = true;
         for( ; o; o = o->nextSibling( ) )
         {
            rit.current( )->countChild( o->className( ), afterInsertPoint );
            if( o == after )
               afterInsertPoint = true;
         }
      }
   }

   int number = 0;
   QStringList::const_iterator oit;

   for( oit = list.begin( ); oit != list.end( ); ++oit )
   {
      bool possible = false;
      for( tit.toFirst( ); tit.current( ) && !possible; ++tit )
      {
         QPtrListIterator<PMRule> rit = tit.current( )->rules( );

         for( ; rit.current( ) && !possible; ++rit )
         {
            PMRule* rule = rit.current( );
            if( rule->matches( *oit ) )
               possible = rule->evaluate( parentObject );
         }
      }
      if( possible )
      {
         // object can be inserted, count it
         for( ; tit.current( ); ++tit )
         {
            QPtrListIterator<PMRule> rit = tit.current( )->rules( );
            for( ; rit.current( ); ++rit )
               rit.current( )->countChild( *oit, false );
         }
			number++;
      }
   }

   return number;
}
开发者ID:,项目名称:,代码行数:78,代码来源:


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