Skip to content

Commit

Permalink
use QList::removeAll() instead of QList::remove()
Browse files Browse the repository at this point in the history
the latter one is from Qt3Support
  • Loading branch information
zoltanp committed Nov 22, 2018
1 parent f737c2d commit 8b0ccf1
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions src/canvasmanipulator.cpp
Expand Up @@ -962,7 +962,7 @@ bool CMItemMove::mousePressedInitial( const EventInfo &eventInfo )
}

ItemList itemList = p_cnItemSelectList->items(false);
itemList.remove((Item*)0l);
itemList.removeAll((Item*)0l);

m_bItemsSnapToGrid = false;
const ItemList::iterator itemListEnd = itemList.end();
Expand Down Expand Up @@ -1008,7 +1008,7 @@ void CMItemMove::scrollCanvasToSelection()
{
QRect bound;
ItemList itemList = p_cnItemSelectList->items(false);
itemList.remove((Item*)0l);
itemList.removeAll((Item*)0l);
const ItemList::iterator itemListEnd = itemList.end();
for ( ItemList::iterator it = itemList.begin(); it != itemListEnd; ++it )
bound |= (*it)->boundingRect();
Expand Down
12 changes: 6 additions & 6 deletions src/cnitemgroup.cpp
Expand Up @@ -116,16 +116,16 @@ void CNItemGroup::setItems( KtlQCanvasItemList list )
for ( KtlQCanvasItemList::const_iterator it = list.begin(); it != end; ++it )
{
if ( Item * item = dynamic_cast<Item*>(*it) )
itemRemoveList.remove( item );
itemRemoveList.removeAll( item );

else if ( Node * node = dynamic_cast<Node*>(*it) )
nodeRemoveList.remove( node );
nodeRemoveList.removeAll( node );

else if ( Connector * con = dynamic_cast<Connector*>(*it) )
connectorRemoveList.remove( con );
connectorRemoveList.removeAll( con );

else if ( ConnectorLine * conLine = dynamic_cast<ConnectorLine*>(*it) )
connectorRemoveList.remove( conLine->parent() );
connectorRemoveList.removeAll( conLine->parent() );
}

{
Expand Down Expand Up @@ -185,7 +185,7 @@ void CNItemGroup::removeNode( Node *node )
{
if ( !node || !m_nodeList.contains(node) )
return;
m_nodeList.remove(node);
m_nodeList.removeAll(node);
node->setSelected(false);
updateInfo();
emit nodeRemoved(node);
Expand All @@ -195,7 +195,7 @@ void CNItemGroup::removeNode( Node *node )
void CNItemGroup::removeConnector( Connector *con )
{
if ( !con || !m_connectorList.contains(con) ) return;
m_connectorList.remove(con);
m_connectorList.removeAll(con);
con->setSelected(false);
updateInfo();
emit connectorRemoved(con);
Expand Down
2 changes: 1 addition & 1 deletion src/connector.cpp
Expand Up @@ -220,7 +220,7 @@ void Connector::updateDrawList() {
next++;
}

drawLineList.remove(QPoint(invalid, invalid));
drawLineList.removeAll(QPoint(invalid, invalid));

// Find the bounding rect
{
Expand Down
2 changes: 1 addition & 1 deletion src/conrouter.cpp
Expand Up @@ -477,5 +477,5 @@ void ConRouter::removeDuplicatePoints()
prev = *it;
}
}
m_cellPointList.remove( invalid );
m_cellPointList.removeAll( invalid );
}
4 changes: 2 additions & 2 deletions src/docmanager.cpp
Expand Up @@ -69,7 +69,7 @@ bool DocManager::closeAll()
Document *document = m_documentList.first();
if ( document->fileClose() )
{
m_documentList.remove(document);
m_documentList.removeAll(document);
removeDocumentAssociations(document);
} else return false;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ View *DocManager::createNewView( Document *document, ViewArea *viewArea )
void DocManager::documentDestroyed( QObject *obj )
{
Document *doc = static_cast<Document*>(obj);
m_documentList.remove(doc);
m_documentList.removeAll(doc);
removeDocumentAssociations(doc);
disableContextActions();
}
Expand Down
2 changes: 1 addition & 1 deletion src/document.cpp
Expand Up @@ -70,7 +70,7 @@ void Document::slotViewDestroyed( QObject *obj )
{
View *view = static_cast<View*>(obj);

m_viewList.remove(view);
m_viewList.removeAll(view);

if ( m_pActiveView == (QPointer<View>)view )
{
Expand Down
2 changes: 1 addition & 1 deletion src/drawparts/dpline.cpp
Expand Up @@ -171,7 +171,7 @@ DPArrow::DPArrow( ItemDocument *itemDocument, bool newItem, const char *id )

// We don't want to use the square cap style as it screws up drawing our arrow head
QStringList allowed = property("cap-style")->allowed();
allowed.remove( DrawPart::penCapStyleToName( Qt::SquareCap ) );
allowed.removeAll( DrawPart::penCapStyleToName( Qt::SquareCap ) );
property("cap-style")->setAllowed(allowed);

m_headAngle = 20.0;
Expand Down
16 changes: 8 additions & 8 deletions src/electronics/circuitdocument.cpp
Expand Up @@ -357,8 +357,8 @@ void CircuitDocument::componentRemoved( Item * item )

if (!component) return;

m_componentList.remove( component );
m_toSimulateList.remove( component );
m_componentList.removeAll( component );
m_toSimulateList.removeAll( component );

requestAssignCircuits();

Expand All @@ -379,7 +379,7 @@ void CircuitDocument::calculateConnectorCurrents()
PinList groundPins;

// Tell the Pins to reset their calculated currents to zero
m_pinList.remove((Pin*)0);
m_pinList.removeAll((Pin*)0);

const PinList::iterator pinEnd = m_pinList.end();
for ( PinList::iterator it = m_pinList.begin(); it != pinEnd; ++it )
Expand Down Expand Up @@ -410,7 +410,7 @@ void CircuitDocument::calculateConnectorCurrents()


// And now for the wires and switches...
m_wireList.remove((Wire*)0);
m_wireList.removeAll((Wire*)0);
const WireList::iterator clEnd = m_wireList.end();
for ( WireList::iterator it = m_wireList.begin(); it != clEnd; ++it )
(*it)->setCurrentKnown(false);
Expand Down Expand Up @@ -520,7 +520,7 @@ void CircuitDocument::assignCircuits()
splitIntoCircuits(&*it);

// Stage 3: Initialize the circuits
m_circuitList.remove(0l);
m_circuitList.removeAll(0l);
CircuitList::iterator circuitListEnd = m_circuitList.end();
for ( CircuitList::iterator it = m_circuitList.begin(); it != circuitListEnd; ++it )
(*it)->init();
Expand Down Expand Up @@ -563,7 +563,7 @@ void CircuitDocument::getPartition( Pin *pin, PinList *pinList, PinList *unassig
{
if (!pin) return;

unassignedPins->remove(pin);
unassignedPins->removeAll(pin);

if ( pinList->contains(pin) ) return;

Expand Down Expand Up @@ -649,7 +649,7 @@ void CircuitDocument::recursivePinAdd( Pin *pin, Circuitoid *circuitoid, PinList
if(!pin) return;

if(pin->eqId() != -1 )
unassignedPins->remove(pin);
unassignedPins->removeAll(pin);

if(circuitoid->contains(pin) ) return;

Expand Down Expand Up @@ -770,7 +770,7 @@ void CircuitDocument::createSubcircuit()
*it = 0;
}

itemList.remove((Item*)0);
itemList.removeAll((Item*)0);

if ( itemList.isEmpty() ) {
KMessageBox::sorry( activeView(), i18n("No components were found in the selection.") );
Expand Down
2 changes: 1 addition & 1 deletion src/electronics/circuiticndocument.cpp
Expand Up @@ -334,7 +334,7 @@ void CircuitICNDocument::flushDeleteList()
}
}

m_itemDeleteList.remove(0);
m_itemDeleteList.removeAll(0);

/* again we're spending time to figure out what special method to call instead of a generic call..*/
end = m_itemDeleteList.end();
Expand Down
4 changes: 2 additions & 2 deletions src/electronics/component.cpp
Expand Up @@ -150,7 +150,7 @@ void Component::removeSwitch( Switch *sw )

emit switchDestroyed( sw );
delete sw;
m_switchList.remove(sw);
m_switchList.removeAll(sw);
m_pCircuitDocument->requestAssignCircuits();
}

Expand Down Expand Up @@ -870,7 +870,7 @@ MOSFET * Component::createMOSFET( Pin * D, Pin * G, Pin * S, Pin * B, int MOSFET
pins << D << G << S << B;

/// \todo remove the following line removing body if null
pins.remove( 0 );
pins.removeAll( 0 );

ElementMapList::iterator it = handleElement( e, pins );
setInterDependent( it, pins );
Expand Down
2 changes: 1 addition & 1 deletion src/electronics/ecnode.cpp
Expand Up @@ -281,7 +281,7 @@ Connector* ECNode::createConnector( Node * node)

void ECNode::removeNullConnectors()
{
m_connectorList.remove((Connector*)0L);
m_connectorList.removeAll((Connector*)0L);
}

int ECNode::numCon( bool includeParentItem, bool includeHiddenConnectors ) const
Expand Down
10 changes: 5 additions & 5 deletions src/electronics/pin.cpp
Expand Up @@ -76,7 +76,7 @@ void Pin::setSwitchConnected( Pin * pin, bool isConnected )
m_switchConnectedPins.append(pin);
}
else
m_switchConnectedPins.remove(pin);
m_switchConnectedPins.removeAll(pin);
}

void Pin::setSwitchCurrentsUnknown() {
Expand Down Expand Up @@ -119,7 +119,7 @@ void Pin::addElement( Element * e )

void Pin::removeElement( Element * e )
{
m_elementList.remove(e);
m_elementList.removeAll(e);
}


Expand All @@ -133,7 +133,7 @@ void Pin::addSwitch( Switch * sw )

void Pin::removeSwitch( Switch * sw )
{
m_switchList.remove( sw );
m_switchList.removeAll( sw );
}


Expand All @@ -153,8 +153,8 @@ void Pin::addOutputWire( Wire * wire )

bool Pin::calculateCurrentFromWires()
{
m_inputWireList.remove( (Wire*)0l );
m_outputWireList.remove( (Wire*)0l );
m_inputWireList.removeAll( (Wire*)0l );
m_outputWireList.removeAll( (Wire*)0l );

const WireList inputs = m_inputWireList;
const WireList outputs = m_outputWireList;
Expand Down
2 changes: 1 addition & 1 deletion src/electronics/subcircuits.cpp
Expand Up @@ -181,7 +181,7 @@ void Subcircuits::slotItemRemoved( const QString &id )
KSharedConfigPtr config = KGlobal::config();
KConfigGroup grSc = config->group("Subcircuits");
QList<int> idList = asIntList( grSc.readEntry<QString>(QString("Ids"), QString()) );
idList.remove(id_num);
idList.removeAll(id_num);
grSc.writeEntry( "Ids", idList );
}

Expand Down
6 changes: 3 additions & 3 deletions src/flowcontainer.cpp
Expand Up @@ -72,13 +72,13 @@ void FlowContainer::filterEndPartIDs( QStringList *ids )
{
// Remove *all* nodes except for very bottom one
if (m_int_out) {
ids->remove(m_int_out->childId());
ids->removeAll(m_int_out->childId());
}
if (m_ext_in) {
ids->remove(m_ext_in->childId());
ids->removeAll(m_ext_in->childId());
}
if (m_int_in) {
ids->remove(m_int_in->childId());
ids->removeAll(m_int_in->childId());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/flowparts/flowicndocument.cpp
Expand Up @@ -331,7 +331,7 @@ void FlowICNDocument::flushDeleteList()
*it = 0l;
}
}
m_itemDeleteList.remove ( 0l );
m_itemDeleteList.removeAll ( 0l );

end = m_itemDeleteList.end();
for ( KtlQCanvasItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/itemselector.cpp
Expand Up @@ -291,7 +291,7 @@ void ItemSelector::slotRemoveSelectedItem()
// Get rid of the category as well if it has no children
if ( parent && !parent->childCount() /* firstChild() */ )
{
m_categories.remove(parent->text(0));
m_categories.removeAll(parent->text(0));
delete parent;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/icndocument.cpp
Expand Up @@ -385,7 +385,7 @@ void ICNDocument::getTranslatable(const ItemList &itemList, ConnectorList *fixed
}

ConnectorList conList = cnItem->connectorList();
conList.remove((Connector*)0);
conList.removeAll((Connector*)0);

const ConnectorList::iterator clEnd = conList.end();
for ( ConnectorList::iterator clit = conList.begin(); clit != clEnd; ++clit )
Expand Down Expand Up @@ -414,7 +414,7 @@ void ICNDocument::getTranslatable(const ItemList &itemList, ConnectorList *fixed
NodeList externalNodeList = ng->externalNodeList();
const NodeList::iterator itemNodeListEnd = itemNodeList.end();
for ( NodeList::iterator inlIt = itemNodeList.begin(); inlIt != itemNodeListEnd; ++inlIt )
externalNodeList.remove(*inlIt);
externalNodeList.removeAll(*inlIt);

if ( externalNodeList.isEmpty() )
{
Expand Down Expand Up @@ -579,7 +579,7 @@ void ICNDocument::copy()
if ( it.value().size() > 1 )
nodeList.append(it.key());
else if ( it.value().size() > 0 )
connectorList.remove( it.value().at(0) );
connectorList.removeAll( it.value().at(0) );
}

data.addItems( m_selectList->items(false) );
Expand Down Expand Up @@ -816,7 +816,7 @@ ConnectorList ICNDocument::getCommonConnectors( const ItemList &list )
*it = 0;
}
}
connectorList.remove((Connector*)0);
connectorList.removeAll((Connector*)0);
return connectorList;
}

Expand Down
2 changes: 1 addition & 1 deletion src/item.cpp
Expand Up @@ -481,7 +481,7 @@ void Item::removeChild( Item *child )
if ( !child || !m_children.contains(child) )
return;

m_children.remove(child);
m_children.removeAll(child);
disconnect( child, SIGNAL(removed(Item* )), this, SLOT(removeChild(Item* )) );

childRemoved(child);
Expand Down
2 changes: 1 addition & 1 deletion src/itemdocument.cpp
Expand Up @@ -736,7 +736,7 @@ void ItemDocument::resizeCanvasToItems()
{
QRect bound = canvasBoundingRect();

m_viewList.remove((View*)0);
m_viewList.removeAll((View*)0);
const ViewList::iterator end = m_viewList.end();
for ( ViewList::iterator it = m_viewList.begin(); it != end; ++it ) {
ItemView * iv = static_cast<ItemView*>((View*)*it);
Expand Down
12 changes: 6 additions & 6 deletions src/itemdocumentdata.cpp
Expand Up @@ -906,11 +906,11 @@ void ItemDocumentData::restoreDocument( ItemDocument *itemDocument )

{
ItemList removeItems = itemDocument->itemList();
removeItems.remove((Item*)0l);
removeItems.removeAll((Item*)0l);

const ItemDataMap::iterator end = m_itemDataMap.end();
for ( ItemDataMap::iterator it = m_itemDataMap.begin(); it != end; ++it )
removeItems.remove( itemDocument->itemWithID(it.key()) );
removeItems.removeAll( itemDocument->itemWithID(it.key()) );

const ItemList::iterator removeEnd = removeItems.end();
for ( ItemList::iterator it = removeItems.begin(); it != removeEnd; ++it )
Expand All @@ -924,11 +924,11 @@ void ItemDocumentData::restoreDocument( ItemDocument *itemDocument )
{
{
NodeList removeNodes = icnd->nodeList();
removeNodes.remove((Node*)0l);
removeNodes.removeAll((Node*)0l);

const NodeDataMap::iterator end = m_nodeDataMap.end();
for ( NodeDataMap::iterator it = m_nodeDataMap.begin(); it != end; ++it )
removeNodes.remove( icnd->nodeWithID( it.key() ) );
removeNodes.removeAll( icnd->nodeWithID( it.key() ) );

const NodeList::iterator removeEnd = removeNodes.end();
for ( NodeList::iterator it = removeNodes.begin(); it != removeEnd; ++it )
Expand All @@ -939,11 +939,11 @@ void ItemDocumentData::restoreDocument( ItemDocument *itemDocument )
}
{
ConnectorList removeConnectors = icnd->connectorList();
removeConnectors.remove((Connector*)0l);
removeConnectors.removeAll((Connector*)0l);

const ConnectorDataMap::iterator end = m_connectorDataMap.end();
for ( ConnectorDataMap::iterator it = m_connectorDataMap.begin(); it != end; ++it )
removeConnectors.remove( icnd->connectorWithID(it.key()) );
removeConnectors.removeAll( icnd->connectorWithID(it.key()) );

const ConnectorList::iterator removeEnd = removeConnectors.end();
for ( ConnectorList::iterator it = removeConnectors.begin(); it != removeEnd; ++it )
Expand Down

0 comments on commit 8b0ccf1

Please sign in to comment.