本文整理汇总了C++中QPtrList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::count方法的具体用法?C++ QPtrList::count怎么用?C++ QPtrList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sort
void QTodoList::sort()
{
QTodoSortDialog sort_dialog;
deselectAll();
if(sort_dialog.exec() == QDialog::Accepted)
{
preserveContentsYPos();
const QTodoSortCriteriaMap* criterias = sort_dialog.getCriterias();
QPtrList<QWidget> list_widgets;
list_widgets.append(0);
QTodoListIterator it(this);
for(;it.current();++it)
list_widgets.append(it.current());
QTodoListItemsSorter sorter(&list_widgets,criterias);
QPtrList<QWidget>* sorted = sorter.get();
QTUM::get()->startRecording();
takeAll();
for(unsigned int i = 0; i < sorted->count(); ++i)
{
if(QTodoItem* item = dynamic_cast<QTodoItem*>(sorted->at(i)))
{
insertTodo(item,i);
item->setDepth(item->getDepth());
}
}
QTUM::get()->stopRecording();
restoreContentsYPos();
}
}
示例2: setProperty
void CSSStyleDeclarationImpl::setProperty ( const DOMString &propertyString)
{
DOMString ppPropertyString = preprocess(propertyString.string(),true);
QPtrList<CSSProperty> *props = parseProperties(ppPropertyString.unicode(),
ppPropertyString.unicode()+ppPropertyString.length());
if(!props || !props->count())
return;
props->setAutoDelete(false);
if(!m_lstValues) {
m_lstValues = new QPtrList<CSSProperty>;
m_lstValues->setAutoDelete( true );
}
CSSProperty *prop = props->first();
while( prop ) {
removeProperty(prop->m_id, false);
m_lstValues->append(prop);
prop = props->next();
}
delete props;
setChanged();
}
示例3: dlg
Resource *ResourceSelectDialog::getResource(AddressBook *ab, QWidget *parent)
{
QPtrList< Resource > resources = ab->resources();
if(resources.count() == 1)
return resources.first();
Resource *found = 0;
Resource *r = resources.first();
while(r)
{
if(!r->readOnly())
{
if(found)
{
found = 0;
break;
}
else
{
found = r;
}
}
r = resources.next();
}
if(found)
return found;
ResourceSelectDialog dlg(ab, parent);
if(dlg.exec() == KDialog::Accepted)
return dlg.resource();
else
return 0;
}
示例4: printf
void
xQGanttBarViewPort::deleteSelectedItems()
{
#ifdef _DEBUG_
printf("-> xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
QPtrList<KGanttItem> list;
observeList(&list);
getSelectedItems(_toplevelitem, list);
for(KGanttItem *subitem = list.first();
subitem != 0;
subitem = list.next())
{
#ifdef _DEBUG_
printf(" : %s \n", subitem->getText().latin1());
#endif
connect(subitem, SIGNAL(destroyed(KGanttItem *)),
this, SLOT(itemDestroyed(KGanttItem *)));
}
list.remove(_toplevelitem);
while(list.count() > 0)
{
KGanttItem *item = list.getFirst();
delete item;
}
#ifdef _DEBUG_
printf("<- xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
}
示例5: slotCursorRight
// -----------------------------------------------------------
void QucsApp::slotCursorRight()
{
if(!editText->isHidden()) return; // for edit of component property ?
QPtrList<Element> movingElements;
Schematic *Doc = (Schematic*)DocumentTab->currentPage();
int markerCount = Doc->copySelectedElements(&movingElements);
if((movingElements.count() - markerCount) < 1) {
if(markerCount > 0) { // only move marker if nothing else selected
Doc->markerLeftRight(false, &movingElements);
movingElements.clear();
}
else {
if(Doc->scrollRight(-Doc->horizontalScrollBar()->lineStep()))
Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
}
Doc->viewport()->update();
view->drawn = false;
return;
}
view->moveElements(&movingElements, Doc->GridX, 0); // move "GridX" to right
view->MAx3 = 1; // sign for moved elements
view->endElementMoving(Doc, &movingElements);
}
示例6: slotWindowMenuCallback
//
// A window title was selected from window menu, show that window
//
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
{
assert(false);
}
disconnect(m_windowMenu);
}
}
示例7: getMATypes
PlotLine * THERM::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
// format1: MA_TYPE, MA_PERIOD, THRESHOLD, SMOOTHING_TYPE, SMOOTHING_PERIOD
if (checkFormat(p, d, 5, 5))
return 0;
QStringList mal;
getMATypes(mal);
maType = mal.findIndex(formatStringList[0]);
maPeriod = formatStringList[1].toInt();
threshold = formatStringList[2].toDouble();
smoothType = mal.findIndex(formatStringList[3]);
smoothing = formatStringList[4].toInt();
QPtrList<PlotLine> pll;
pll.setAutoDelete(FALSE);
getTHERM(pll);
int loop;
for (loop = pll.count() - 1; loop > 0; loop--)
pll.remove(loop);
return pll.at(0);
}
示例8: slotEdit
void KMMimePartTree::slotEdit()
{
QPtrList<QListViewItem> selected = selectedItems();
if ( selected.count() != 1 )
return;
mReaderWin->slotEditAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
示例9: 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;
}
示例10: 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);
}
}
示例11: page
Page * page( const QWidget * w )
{
if ( !w )
return 0;
int i = pages.count();
while( --i >= 0 && pages.at( i ) && pages.at( i )->w != w ) { }
return i >= 0 ? pages.at( i ) : 0;
}
示例12: int
QLayoutItem *BorderLayoutIterator::takeCurrent()
{
BorderLayout::BorderLayoutStruct *b
= idx < int( list->count() ) ? list->take( idx ) : 0;
QLayoutItem *item = b ? b->item : 0;
delete b;
return item;
}
示例13:
ShapeCLPolygon::ShapeCLPolygon( int id, QPtrList<Point>& plist ) {
_shapeID = id;
_type = 998;
numPoints = plist.count();
points = new Point[numPoints];
for( int i=0; i<numPoints; i++ ) {
this->points[i].setXY( plist.at(i)->x(), plist.at(i)->y() );
}
}
示例14: validatePluginActions
void KMCupsJobManager::validatePluginActions(KActionCollection *coll, const QPtrList<KMJob>& joblist)
{
QPtrListIterator<KMJob> it(joblist);
bool flag(true);
for (; it.current(); ++it)
{
flag = (flag && it.current()->type() == KMJob::System
&& (it.current()->state() == KMJob::Queued || it.current()->state() == KMJob::Held)
/*&& !it.current()->isRemote()*/);
}
flag = (flag && joblist.count() > 0);
KAction *a;
if ( ( a = coll->action( "plugin_ipp" ) ) )
a->setEnabled( joblist.count() == 1 );
if ( ( a = coll->action( "plugin_prioup" ) ) )
a->setEnabled( flag );
if ( ( a = coll->action( "plugin_priodown" ) ) )
a->setEnabled( flag );
if ( ( a = coll->action( "plugin_editjob" ) ) )
a->setEnabled( flag && ( joblist.count() == 1 ) );
}
示例15: 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 ) );
}