void View::Private::slotCollapsed(const QModelIndex& _idx) { QTreeView* tw = qobject_cast<QTreeView*>(leftWidget); if (!tw) return; bool blocked = gfxview->blockSignals( true ); QModelIndex idx( _idx ); const QAbstractItemModel* model = leftWidget->model(); const QModelIndex pidx = ganttProxyModel.mapFromSource(idx); bool isMulti = false; for ( QModelIndex treewalkidx = pidx; treewalkidx.isValid(); treewalkidx = treewalkidx.parent() ) { if ( treewalkidx.data( ItemTypeRole ).toInt() == TypeMulti && !gfxview->rowController()->isRowExpanded( treewalkidx ) ) { isMulti = true; break; } } if ( !isMulti ) { for ( int i = 0; i < model->rowCount( idx ); ++i ) { gfxview->deleteSubtree( ganttProxyModel.index( i, 0, pidx ) ); } } else { gfxview->updateRow(pidx); } //qDebug() << "Looking to update from " << idx; while ( ( idx=tw->indexBelow( idx ) ) != QModelIndex() && gfxview->rowController()->isRowVisible( ganttProxyModel.mapFromSource(idx) ) ) { const QModelIndex proxyidx( ganttProxyModel.mapFromSource( idx ) ); gfxview->updateRow(proxyidx); } gfxview->blockSignals( blocked ); gfxview->updateSceneRect(); }
int TreeView::indexBelow(lua_State * L) // ( const QModelIndex & index ) const : QModelIndex { QTreeView* obj = QtObject<QTreeView>::check( L, 1); QModelIndex* index = QtValue<QModelIndex>::check( L, 2 ); QModelIndex* res = QtValue<QModelIndex>::create( L ); *res = obj->indexBelow( *index ); return 1; }