本文整理汇总了C++中QObjectList::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList::remove方法的具体用法?C++ QObjectList::remove怎么用?C++ QObjectList::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObjectList
的用法示例。
在下文中一共展示了QObjectList::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
/** Redrawing the View */
void Katalysator2View::paintEvent(QPaintEvent *ev){
objekte.clear();
Katalysator2Doc *doc;
doc=getDocument();
/** Getting the XML-Document */
QDomDocument* XMLdoc=doc->getDocument();
/** Getting the list of the used KRohr-View-Widgets in this View */
list<QString> name_list;
list<QString>::iterator p;
QObjectList * l = topLevelWidget()->queryList( "KRohr_View" );
// l->setAutoDelete( TRUE );
QObjectListIt it( *l ); // iterate over the widgets
QObjectListIt it2( *l );
QObject * obj;
QString name;
while ( (obj=it.current()) != 0 ) { // for each found object...
++it;
if((( KRohr_View*)obj)->isHidden()){
cout<<"loesche Eintrag weil versteckt (katalysator2view::paintevent): "<<name<<endl;
it2=it;
--it;
l->remove(it2);
delete obj;
}
else{
name = (( KRohr_View*)obj)->getName();
p=std::find(name_list.begin(),name_list.end(), name);
if(p==name_list.end()){
name_list.push_back(name);
}
else{
cout<<"loesche Eintrag wegen Namen (katalysator2view::paintevent): "<<name<<endl;
it2=it;
--it;
(( KRohr_View*)obj)->hide();
l->remove(it2);
delete obj;
}
}
// ((QButton*)obj)->setEnabled( FALSE );
}
delete l; // delete the list, not the objects
QDomElement docElem = XMLdoc->documentElement();
QDomNode & n = docElem.firstChild();
while( !n.isNull() ) {
QDomElement & e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) { // the node was really an element.
cout << e.tagName() << endl;
if (e.tagName()=="pipe"){
p=std::find(name_list.begin(),name_list.end(), e.attribute("name"));
if(p==name_list.end()){
NewPipe(e);
}
else name_list.erase(p);
}
}
n = n.nextSibling();
}
for (p=name_list.begin();p!=name_list.end();p++)
cout <<"remaining: "<<*p<<endl;
}