MCPcopy Create free account
hub / github.com/KDE/kdevelop / takeRow

Method takeRow

kdevplatform/project/projectmodel.cpp:190–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190ProjectBaseItem* ProjectBaseItem::takeRow(int row)
191{
192 Q_D(ProjectBaseItem);
193 Q_ASSERT(row >= 0 && row < d->children.size());
194
195 if( model() ) {
196 model()->beginRemoveRows(index(), row, row);
197 }
198 ProjectBaseItem* olditem = d->children.takeAt( row );
199 olditem->d_func()->parent = nullptr;
200 olditem->d_func()->row = -1;
201 olditem->setModel( nullptr );
202
203 for (int i = row, count = d->children.size(); i < count; i++) {
204 auto sibling = d->children.at(i);
205 Q_ASSERT(sibling->d_func()->row == i + 1);
206 sibling->d_func()->row = i;
207 }
208
209 if( model() ) {
210 model()->endRemoveRows();
211 }
212 return olditem;
213}
214
215void ProjectBaseItem::removeRow( int row )
216{

Callers 5

renameMethod · 0.80
~ProjectBaseItemMethod · 0.80
testTakeRowMethod · 0.80
slotDirtyMethod · 0.80
closedMethod · 0.80

Calls 6

modelFunction · 0.85
d_funcMethod · 0.80
indexFunction · 0.50
sizeMethod · 0.45
setModelMethod · 0.45
atMethod · 0.45

Tested by 1

testTakeRowMethod · 0.64