File indexing completed on 2024-05-19 12:23:50
0001 /* 0002 SPDX-FileCopyrightText: 2005 Adam Treat <treat@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "kdevdocumentselection.h" 0008 0009 KDevDocumentSelection::KDevDocumentSelection( QAbstractItemModel * model ) 0010 : QItemSelectionModel( model ) 0011 {} 0012 0013 KDevDocumentSelection::~KDevDocumentSelection() 0014 {} 0015 0016 void KDevDocumentSelection::select( const QModelIndex & index, 0017 QItemSelectionModel::SelectionFlags command ) 0018 { 0019 if ( !index.parent().isValid() ) 0020 QItemSelectionModel::select( index, NoUpdate ); 0021 else 0022 QItemSelectionModel::select( index, command ); 0023 } 0024 0025 void KDevDocumentSelection::select( const QItemSelection & selection, 0026 QItemSelectionModel::SelectionFlags command ) 0027 { 0028 const QList<QModelIndex> selections = selection.indexes(); 0029 for (auto& selection : selections) { 0030 if (!selection.parent().isValid()) { 0031 QItemSelectionModel::select(selection, NoUpdate); 0032 return; 0033 } 0034 } 0035 0036 QItemSelectionModel::select( selection, command ); 0037 } 0038 0039 #include "moc_kdevdocumentselection.cpp"