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


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

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


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

示例1: slotWindowMenuCallback

void App::slotWindowMenuCallback(int item)
{
	QPtrList <QWidget> wl = workspace()->windowList();

	if (item == ID_WINDOW_CASCADE || item == ID_WINDOW_TILE)
	{
		return;
	}

	if (wl.count())
	{
		QWidget* widget;

		widget = wl.at(item);
		if (widget != NULL)
		{
			widget->show();
			widget->setFocus();
		}
		else
		{
			QMessageBox::critical(this,
					      "Unable to select window",
					      "Handle not found");
		}

		disconnect(m_windowMenu);
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:29,代码来源:app.cpp

示例2: selectedItems

QDragObject *KfindWindow::dragObject()
{
    KURL::List uris;
    QPtrList< QListViewItem > selected = selectedItems();

    // create a list of URIs from selection
    for(uint i = 0; i < selected.count(); i++)
    {
        KfFileLVI *item = (KfFileLVI *)selected.at(i);
        if(item)
        {
            uris.append(item->fileitem.url());
        }
    }

    if(uris.count() <= 0)
        return 0;

    QUriDrag *ud = new KURLDrag(uris, (QWidget *)this, "kfind uridrag");

    const QPixmap *pix = currentItem()->pixmap(0);
    if(pix && !pix->isNull())
        ud->setPixmap(*pix);

    return ud;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:26,代码来源:kfwin.cpp

示例3: paintOutlines

void RenderFlow::paintOutlines(QPainter *p, int _tx, int _ty)
{
    if (style()->outlineStyle() <= BHIDDEN)
        return;
    
    QPtrList <QRect> rects;
    rects.setAutoDelete(true);
    
    rects.append(new QRect(0,0,0,0));
    for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
        rects.append(new QRect(curr->xPos(), curr->yPos(), curr->width(), curr->height()));
    }
    rects.append(new QRect(0,0,0,0));
    
    for (unsigned int i = 1; i < rects.count() - 1; i++)
        paintOutlineForLine(p, _tx, _ty, *rects.at(i-1), *rects.at(i), *rects.at(i+1));
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:17,代码来源:render_flow.cpp

示例4: slotChangeColorName

void CustomPalette::slotChangeColorName( const QString &new_name )
{
    if ( sel_row != -1 && sel_col != -1 )
    {
        color_names[sel_row][sel_col] = new_name;

	QPtrList<Color> cl = k_toon -> document() -> getPalette() -> getColors();
	Color *s_color = cl.at( map2Dto1D( sel_row, sel_col ) );
	s_color -> setNameColor( new_name );
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:11,代码来源:custompalette.cpp

示例5: dockWindow

void QDockArea::dockWindow( QDockWindow *dockWindow, DockWindowData *data )
{
    if ( !data )
	return;

    dockWindow->reparent( this, QPoint( 0, 0 ), FALSE );
    dockWindow->installEventFilter( this );
    dockWindow->dockArea = this;
    dockWindow->updateGui();

    if ( dockWindows->isEmpty() ) {
	dockWindows->append( dockWindow );
    } else {
	QPtrList<QDockWindow> lineStarts = layout->lineStarts();
	int index = 0;
	if ( (int)lineStarts.count() > data->line )
	    index = dockWindows->find( lineStarts.at( data->line ) );
	if ( index == -1 ) {
	    index = 0;
	    (void)dockWindows->at( index );
	}
	bool firstTime = TRUE;
	int offset = data->offset;
	for ( QDockWindow *dw = dockWindows->current(); dw; dw = dockWindows->next() ) {
	    if ( !firstTime && lineStarts.find( dw ) != -1 )
		break;
	    if ( offset <
		 point_pos( fix_pos( dw ), orientation() ) + size_extent( dw->size(), orientation() ) / 2 )
		break;
	    index++;
	    firstTime = FALSE;
	}
	if ( index >= 0 && index < (int)dockWindows->count() &&
	     dockWindows->at( index )->newLine() && lineOf( index ) == data->line ) {
	    dockWindows->at( index )->setNewLine( FALSE );
	    dockWindow->setNewLine( TRUE );
	} else {
	    dockWindow->setNewLine( FALSE );
	}

	dockWindows->insert( index, dockWindow );
    }
    dockWindow->show();

    dockWindow->setFixedExtentWidth( data->fixedExtent.width() );
    dockWindow->setFixedExtentHeight( data->fixedExtent.height() );

    updateLayout();
    setSizePolicy( QSizePolicy( orientation() == Horizontal ? QSizePolicy::Expanding : QSizePolicy::Minimum,
				orientation() == Vertical ? QSizePolicy::Expanding : QSizePolicy::Minimum ) );

}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:52,代码来源:qdockarea.cpp

示例6: stopBroadcast

void DvbStream::stopBroadcast()
{
	int i;
	DVBout *o=0;
	QPtrList<DVBout> p;

	for ( i=0; i<(int)out.count(); i++ ) {
		o = out.at(i);
		o->stopBroadcast();
		if ( !o->hasLive() && !o->hasRec() )
			p.append( o );
	}
	for ( i=0; i<(int)p.count(); i++ ) {
		removePids( p.at(i) );
		if ( cam )
			cam->stopService( &(p.at(i)->channel) );
		removeOut( p.at(i) );
	}
	if ( out.count()==0 )
		stop();
	emit isBroadcasting( false );
}
开发者ID:iegor,项目名称:kdesktop,代码行数:22,代码来源:dvbstream.cpp

示例7: 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

示例8: nextToolView

void DockContainer::nextToolView()
{
    QPtrList< KMultiTabBarTab > *tabs = m_tb->tabs();
    int pos = tabs->findRef(m_tb->tab(oldtab));
    if(pos == -1)
        return;
    pos++;
    if(pos >= (int)tabs->count())
        pos = 0;
    KMultiTabBarTab *tab = tabs->at(pos);
    if(!tab)
        return; // can never happen here, but who knows
    m_tb->setTab(tab->id(), true);
    tabClicked(tab->id());
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例9: getTHERM

Indicator * THERM::calculate ()
{
  Indicator *output = new Indicator;
  output->setDateFlag(dateFlag);
  output->setLogScale(logScale);

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getTHERM(pll);

  int loop;
  for (loop = 0; loop < (int) pll.count(); loop++)
    output->addLine(pll.at(loop));

  return output;
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:16,代码来源:THERM.cpp

示例10: setupTextFrames

void KWDocStructTextFrameSetItem::setupTextFrames()
{
    // TODO: KWTextFrameSet::frame() method returns frames in screen order?
    // Build a list of frame pointers.
    QPtrList<KWFrame> framePtrs;
    framePtrs.setAutoDelete(false);
    for (uint j = 0; j < m_frameset->frameCount(); j++)
        framePtrs.append(m_frameset->frame(j));

    // Remove deleted frames from the listview.
    KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
    KWDocStructTextFrameItem* delItem;
    while (item) {
        delItem = item;
        item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
        if (framePtrs.containsRef(delItem->frame()) == 0) delete delItem;
    }

    // Add new frames to the list or update existing ones.
    KWDocument* dok = doc();
    KWDocStructTextFrameItem* after = 0;
    for (uint j = 0; j < framePtrs.count(); j++)
    {
        KWFrame* frame = framePtrs.at(j);
        QString name;
        if ( KListViewItem::parent()->firstChild() == this && dok->processingType() == KWDocument::WP )
        {
            if ( dok->numColumns() == 1 )
                name=i18n( "Page %1" ).arg(QString::number(j + 1));
            else
                name=i18n( "Column %1" ).arg(QString::number(j + 1));
        }
        else
            name=i18n( "Text Frame %1" ).arg(QString::number(j + 1));
        KWDocStructTextFrameItem* child = findTextFrameItem(frame);
        if (child)
            child->setText(0, name);
        else {
            if (after)
                child = new KWDocStructTextFrameItem(this, after, name, m_frameset, frame);
            else
                child = new KWDocStructTextFrameItem(this, name, m_frameset, frame);
        }
        child->setupTextParags();
        after = child;
    }
}
开发者ID:,项目名称:,代码行数:47,代码来源:

示例11: setupCells

void KWDocStructTableItem::setupCells()
{
    // TODO: KWTableFrameSet::cell() method returns cells in screen order?
    // Build a list of cell pointers.
    QPtrList<KWTextFrameSet> cellPtrs;
    cellPtrs.setAutoDelete(false);
    for (uint row = 0; row < m_table->getRows(); ++row)
        for (uint col = 0; col < m_table->getColumns(); ++ col) {
            KWTextFrameSet* cell = m_table->cell(row, col);
            if (cell)
                cellPtrs.append(cell);
        }

    // Remove deleted cells from the listview.
    KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
    KWDocStructTextFrameItem* delItem;
    while (item) {
        delItem = item;
        item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
        if (cellPtrs.containsRef(delItem->frameSet()) == 0) delete delItem;
    }

    // Add new cells to the list or update existing ones.
    // Note we skip over the frameset and add the frame instead,
    // as every cell has exactly one frame in the frameset.
    KWDocStructTextFrameItem* child;
    KWDocStructTextFrameItem* after = 0;
    for (uint j = 0; j < cellPtrs.count(); j++)
    {
        KWTextFrameSet* cell = cellPtrs.at(j);
        KWFrame* frame = cell->frame(0);
        if (frame) {
            QString name = cell->name();
            child = findCellItem(cell);
            if (child)
                child->setText(0, name);
            else {
                if (after)
                    child = new KWDocStructTextFrameItem(this, after, name, cell, frame);
                else
                    child = new KWDocStructTextFrameItem(this, name, cell, frame);
            }
            child->setupTextParags();
            after = child;
        }
    }
}
开发者ID:,项目名称:,代码行数:47,代码来源:

示例12: slotChain

void KSSLInfoDlg::slotChain(int x)
{
    if(x == 0)
    {
        displayCert(d->_cert);
    }
    else
    {
        QPtrList< KSSLCertificate > cl = d->_cert->chain().getChain();
        cl.setAutoDelete(true);
        for(int i = 0; i < x - 1; i++)
            cl.remove((unsigned int)0);
        KSSLCertificate thisCert = *(cl.at(0));
        cl.remove((unsigned int)0);
        thisCert.chain().setChain(cl);
        displayCert(&thisCert);
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例13: deleteFiles

void KfindWindow::deleteFiles()
{
    QString tmp =
        i18n("Do you really want to delete the selected file?", "Do you really want to delete the %n selected files?", selectedItems().count());
    if(KMessageBox::warningContinueCancel(parentWidget(), tmp, "", KGuiItem(i18n("&Delete"), "editdelete")) == KMessageBox::Cancel)
        return;

    // Iterate on all selected elements
    QPtrList< QListViewItem > selected = selectedItems();
    for(uint i = 0; i < selected.count(); i++)
    {
        KfFileLVI *item = (KfFileLVI *)selected.at(i);
        KFileItem file = item->fileitem;

        KIO::NetAccess::del(file.url(), this);
    }
    selected.setAutoDelete(true);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:18,代码来源:kfwin.cpp

示例14: showHideBrowser

void
BrowserBar::showHideVisibleBrowser( int index )
{
    int realindex = -1;
    QPtrList<MultiTabBarTab> tabs = *m_tabBar->tabs();
    for( int i = 0, n = tabs.count(); i < n; ++i )
    {
        if( tabs.at( i )->visible() )
            index--;
        if( index < 0 )
        {
            realindex = i;
            break;
        }
    }

    if( realindex >= 0 )
        showHideBrowser( realindex );
}
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:19,代码来源:browserbar.cpp

示例15: KDialog

ResourceSelectDialog::ResourceSelectDialog(AddressBook *ab, QWidget *parent, const char *name) : KDialog(parent, name, true)
{
    setCaption(i18n("Resource Selection"));
    resize(300, 200);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(marginHint());

    QGroupBox *groupBox = new QGroupBox(2, Qt::Horizontal, this);
    groupBox->setTitle(i18n("Resources"));

    mResourceId = new KListBox(groupBox);

    mainLayout->addWidget(groupBox);

    mainLayout->addSpacing(10);

    KButtonBox *buttonBox = new KButtonBox(this);

    buttonBox->addStretch();
    buttonBox->addButton(KStdGuiItem::ok(), this, SLOT(accept()));
    buttonBox->addButton(KStdGuiItem::cancel(), this, SLOT(reject()));
    buttonBox->layout();

    mainLayout->addWidget(buttonBox);

    // setup listbox
    uint counter = 0;
    QPtrList< Resource > list = ab->resources();
    for(uint i = 0; i < list.count(); ++i)
    {
        Resource *resource = list.at(i);
        if(resource && !resource->readOnly())
        {
            mResourceMap.insert(counter, resource);
            mResourceId->insertItem(resource->resourceName());
            counter++;
        }
    }

    mResourceId->setCurrentItem(0);
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:42,代码来源:resourceselectdialog.cpp


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