本文整理汇总了C++中QPtrListIterator类的典型用法代码示例。如果您正苦于以下问题:C++ QPtrListIterator类的具体用法?C++ QPtrListIterator怎么用?C++ QPtrListIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPtrListIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formFileName
QString DesignerProjectImpl::formFileName( const QString &form ) const
{
for ( QPtrListIterator<FormFile> forms = project->formFiles();
forms.current(); ++forms ) {
if ( QString( forms.current()->formName() ) == form )
return forms.current()->fileName();
}
return QString::null;
}
示例2: formNames
QStringList DesignerProjectImpl::formNames() const
{
QStringList l;
for ( QPtrListIterator<FormFile> forms = project->formFiles();
forms.current(); ++forms ) {
FormFile* f = forms.current();
if ( f->isFake() )
continue;
l << f->formName();
}
return l;
}
示例3: RefreshCurrentLevel
void UIListTreeType::RefreshCurrentLevel(void)
{
if (currentlevel)
{
QPtrListIterator<UIListBtnTypeItem> it = currentlevel->GetIterator();
UIListBtnTypeItem *item;
while ((item = it.current()))
{
UIListGenericTree *ui = (UIListGenericTree *)item->getData();
ui->setActive(ui->getActive());
++it;
}
}
}
示例4: objectForFakeForm
QString Project::locationOfObject( QObject *o )
{
if ( !o )
return QString::null;
if ( MainWindow::self ) {
QWidgetList windows = MainWindow::self->qWorkspace()->windowList();
for ( QWidget *w = windows.first(); w; w = windows.next() ) {
FormWindow *fw = ::qt_cast<FormWindow*>(w);
SourceEditor *se = ::qt_cast<SourceEditor*>(w);
if ( fw ) {
if ( fw->isFake() )
return objectForFakeForm( fw )->name() + QString( " [Source]" );
else
return fw->name() + QString( " [Source]" );
} else if ( se ) {
if ( !se->object() )
continue;
if ( se->formWindow() )
return se->formWindow()->name() + QString( " [Source]" );
else
return makeRelative( se->sourceFile()->fileName() );
}
}
}
if ( ::qt_cast<SourceFile*>(o) ) {
for ( QPtrListIterator<SourceFile> sources = sourceFiles();
sources.current(); ++sources ) {
SourceFile* f = sources.current();
if ( f == o )
return makeRelative( f->fileName() );
}
}
extern QMap<QWidget*, QString> *qwf_forms;
if ( !qwf_forms ) {
qWarning( "Project::locationOfObject: qwf_forms is NULL!" );
return QString::null;
}
QString s = makeRelative( *qwf_forms->find( (QWidget*)o ) );
s += " [Source]";
return s;
}
示例5: selectedItem
void KonqSidebarTree::followURL( const KURL &url )
{
// Maybe we're there already ?
KonqSidebarTreeItem *selection = static_cast<KonqSidebarTreeItem *>( selectedItem() );
if (selection && selection->externalURL().equals( url, true ))
{
ensureItemVisible( selection );
return;
}
kdDebug(1201) << "KonqDirTree::followURL: " << url.url() << endl;
QPtrListIterator<KonqSidebarTreeTopLevelItem> topItem ( m_topLevelItems );
for (; topItem.current(); ++topItem )
{
if ( topItem.current()->externalURL().isParentOf( url ) )
{
topItem.current()->module()->followURL( url );
return; // done
}
}
kdDebug(1201) << "KonqDirTree::followURL: Not found" << endl;
}
示例6: disconnect
void Workspace::setCurrentProject( Project *pro )
{
if ( project == pro )
return;
if ( project ) {
disconnect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) );
disconnect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) );
disconnect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) );
disconnect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) );
disconnect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) );
disconnect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) );
disconnect( project, SIGNAL( projectModified() ), this, SLOT( update() ) );
}
project = pro;
connect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) );
connect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) );
connect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) );
connect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) );
connect( project, SIGNAL( destroyed(QObject*) ), this, SLOT( projectDestroyed(QObject*) ) );
connect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) );
connect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) );
connect( project, SIGNAL( projectModified() ), this, SLOT( update() ) );
clear();
if ( bufferEdit )
bufferEdit->clear();
projectItem = new WorkspaceItem( this, project );
projectItem->setOpen( TRUE );
for ( QPtrListIterator<SourceFile> sources = project->sourceFiles();
sources.current(); ++sources ) {
SourceFile* f = sources.current();
(void) new WorkspaceItem( projectItem, f );
}
for ( QPtrListIterator<FormFile> forms = project->formFiles();
forms.current(); ++forms ) {
FormFile* f = forms.current();
if ( f->isFake() )
continue;
(void) new WorkspaceItem( projectItem, f );
}
QObjectList l = project->objects();
QObjectListIt objs( l );
for ( ;objs.current(); ++objs ) {
QObject* o = objs.current();
(void) new WorkspaceItem( projectItem, o, project );
}
updateColors();
completionDirty = TRUE;
}
示例7: breakPoints
void DesignerProjectImpl::breakPoints( QMap<QString, QValueList<uint> > &bps ) const
{
MainWindow::self->saveAllBreakPoints();
for ( QPtrListIterator<SourceFile> sources = project->sourceFiles();
sources.current(); ++sources ) {
SourceFile* f = sources.current();
bps.insert( project->makeRelative( f->fileName() ) + " <Source-File>", MetaDataBase::breakPoints( f ) );
}
for ( QPtrListIterator<FormFile> forms = project->formFiles();
forms.current(); ++forms ) {
if ( forms.current()->formWindow() )
bps.insert( QString( forms.current()->formWindow()->name() ) + " <Form>", MetaDataBase::breakPoints( forms.current()->formWindow() ) );
}
}
示例8: clearAllBreakpoints
void DesignerProjectImpl::clearAllBreakpoints() const
{
QValueList<uint> empty;
for ( QPtrListIterator<SourceFile> sources = project->sourceFiles();
sources.current(); ++sources ) {
SourceFile* f = sources.current();
MetaDataBase::setBreakPoints( f, empty );
}
for ( QPtrListIterator<FormFile> forms = project->formFiles();
forms.current(); ++forms ) {
if ( forms.current()->formWindow() )
MetaDataBase::setBreakPoints( forms.current()->formWindow(), empty );
MainWindow::self->resetBreakPoints();
}
}
示例9: passFinished
}
if (minNextFrame == FrameAnalyzer::ANYFRAME)
minNextFrame = FrameAnalyzer::NEXTFRAME;
if (minNextFrame == FrameAnalyzer::NEXTFRAME)
minNextFrame = frameno + 1;
return minNextFrame;
}
int passFinished(QPtrList<FrameAnalyzer> *pass, long long nframes, bool final)
{
FrameAnalyzer *fa;
for (QPtrListIterator<FrameAnalyzer> iifa(*pass);
(fa = iifa.current()); ++iifa)
(void)fa->finished(nframes, final);
return 0;
}
int passReportTime(QPtrList<FrameAnalyzer> *pass)
{
FrameAnalyzer *fa;
for (QPtrListIterator<FrameAnalyzer> iifa(*pass);
(fa = iifa.current()); ++iifa)
(void)fa->reportTime();
return 0;
示例10: saveConnections
//.........这里部分代码省略.........
for ( QStringList::Iterator spit = sourceKeys.begin(); spit != sourceKeys.end(); ++spit )
remove_multiline_contents( contents, *spit );
}
// libs, defines, includes
writePlatformSettings( contents, "LIBS", lbs );
writePlatformSettings( contents, "DEFINES", defs );
writePlatformSettings( contents, "INCLUDEPATH", inclPath );
writePlatformSettings( contents, "SOURCES", sources );
writePlatformSettings( contents, "HEADERS", headers );
// unix
if ( !hasPreviousContents ) {
contents +=
"unix|os2 {\n"
" UI_DIR = .ui\n"
" MOC_DIR = .moc\n"
" OBJECTS_DIR = .obj\n"
"}\n\n";
}
// sources
if ( !sourcefiles.isEmpty() && iface ) {
QMap<QString, QStringList> sourceToKey;
for ( SourceFile *f = sourcefiles.first(); f; f = sourcefiles.next() ) {
QString key = iface->projectKeyForExtension( QFileInfo( f->fileName() ).extension() );
QStringList lst = sourceToKey[ key ];
lst << makeRelative( f->fileName() );
sourceToKey.replace( key, lst );
}
for ( QMap<QString, QStringList>::Iterator skit = sourceToKey.begin();
skit != sourceToKey.end(); ++skit ) {
QString part = skit.key() + "\t+= ";
QStringList lst = *skit;
for ( QStringList::Iterator sit = lst.begin(); sit != lst.end(); ++sit ) {
part += *sit;
part += ++sit != lst.end() ? " \\\n\t" : "";
--sit;
}
part += "\n\n";
contents += part;
}
}
// forms and interfaces
if ( !formfiles.isEmpty() ) {
contents += "FORMS\t= ";
for ( QPtrListIterator<FormFile> fit = formfiles; fit.current(); ++fit ) {
contents += fit.current()->fileName() +
(fit != formfiles.last() ? " \\\n\t" : "");
}
contents += "\n\n";
}
// images
if ( !pixCollection->isEmpty() ) {
contents += "IMAGES\t= ";
QValueList<PixmapCollection::Pixmap> pixmaps = pixCollection->pixmaps();
for ( QValueList<PixmapCollection::Pixmap>::Iterator it = pixmaps.begin();
it != pixmaps.end(); ++it ) {
contents += makeRelative( (*it).absname );
contents += ++it != pixmaps.end() ? " \\\n\t" : "";
--it;
}
contents += "\n\n";
}
// database
if ( !dbFile.isEmpty() )
contents += "DBFILE\t= " + dbFile + "\n";
// custom settings
for ( QStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) {
QString val = *customSettings.find( *it );
if ( !val.isEmpty() )
contents += *it + "\t= " + val + "\n";
}
if ( !f.open( IO_WriteOnly | IO_Translate ) ) {
QMessageBox::warning( messageBoxParent(),
"Save Project Failed", "Couldn't write project file " + filename );
return;
}
QTextStream os( &f );
os << contents;
if (hasPreviousContents)
os << original;
f.close();
setModified( FALSE );
if ( singleProjectMode() ) {
LanguageInterface *iface = MetaDataBase::languageInterface( language() );
if ( iface && iface->supports( LanguageInterface::CompressProject ) )
iface->compressProject( makeAbsolute( filename ), singleProFileName, TRUE );
}
}
示例11:
StyleSheetListImpl::~StyleSheetListImpl()
{
for ( QPtrListIterator<StyleSheetImpl> it ( styleSheets ); it.current(); ++it )
it.current()->deref();
}
示例12: tit
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;
}
示例13: canInsert
bool PMInsertRuleSystem::canInsert( const PMObject* parentObject,
const QString& className,
const PMObject* after,
const PMObjectList* objectsBetween )
{
bool possible = false;
// find rules for target class
PMMetaObject* meta = parentObject->metaObject( );
for( ; meta && !possible; meta = meta->superClass( ) )
{
PMRuleTargetClass* tc = m_rulesDict.find( meta->className( ) );
if( tc )
{
// check the exception list
QStringList exceptions = tc->exceptions( );
bool exceptionFound = false;
QStringList::ConstIterator it;
for( it = exceptions.begin( );
it != exceptions.end( ) && !exceptionFound; ++it )
if( parentObject->isA( *it ) )
exceptionFound = true;
if( !exceptionFound )
{
QPtrListIterator<PMRule> rit = tc->rules( );
// find matching rules for class name
for( ; rit.current( ) && !possible; ++rit )
{
PMRule* rule = rit.current( );
if( rule->matches( className ) )
{
// matching rule found
// reset the rule
rit.current( )->reset( );
// count already inserted child objects
bool afterInsertPoint = false;
PMObject* o = parentObject->firstChild( );
if( !after )
afterInsertPoint = true;
for( ; o; o = o->nextSibling( ) )
{
rule->countChild( o->className( ), afterInsertPoint );
if( o == after )
afterInsertPoint = true;
}
if( objectsBetween )
{
PMObjectListIterator it( *objectsBetween );
for( ; it.current( ); ++it )
rule->countChild( it.current( )->type( ), false );
}
// evaluate condition value
possible = rule->evaluate( parentObject );
}
}
}
}
}
return possible;
}
示例14: Init
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())
//.........这里部分代码省略.........
示例15: incSearchNext
bool UIListBtnType::incSearchNext(void)
{
if (!m_selItem)
{
return false;
}
//
// Move the active node to the node whose string value
// starts or contains the search text
//
QPtrListIterator<UIListBtnTypeItem> it = (*m_selIterator);
++it;
while (it.current())
{
if (m_bIncSearchContains)
{
if (it.current()->text().find(m_incSearch, 0, false) != -1)
break;
}
else
{
if (it.current()->text().startsWith(m_incSearch, false))
break;
}
++it;
}
// if it is NULL, we reached the end of the list. wrap to the
// beginning and try again
if (!it.current())
{
it.toFirst();
while (it.current())
{
// we're back at the current_node, which means there are no
// matching nodes
if (it.current() == m_selItem)
{
break;
}
if (m_bIncSearchContains)
{
if (it.current()->text().find(m_incSearch, 0, false) != -1)
break;
}
else
{
if (it.current()->text().startsWith(m_incSearch, false))
break;
}
++it;
}
}
if (it.current())
{
SetItemCurrent(it.current());
return true;
}
return false;
}