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

Method itemActivated

plugins/documentswitcher/documentswitcherplugin.cpp:172–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void DocumentSwitcherPlugin::itemActivated( const QModelIndex& idx )
173{
174 Q_UNUSED( idx );
175 if( view->selectionModel()->selectedRows().isEmpty() )
176 {
177 return;
178 }
179 const int row = view->selectionModel()->selectedRows().first().row();
180
181 // Retrieve document from index
182 auto* activatedDocument = documentLists.value(row);
183 if( activatedDocument ) {
184 // Close document
185 if( QApplication::mouseButtons() & Qt::MiddleButton )
186 {
187 activatedDocument->close();
188 fillModel();
189 if ( model->rowCount() == 0 ) {
190 view->hide();
191 } else {
192 view->selectionModel()->select( view->model()->index(0, 0), QItemSelectionModel::ClearAndSelect );
193 }
194 }
195 // Activate document
196 else
197 {
198 KDevelop::IDocumentController *documentController = KDevelop::ICore::self()->documentController();
199 documentController->activateDocument(activatedDocument);
200 view->hide();
201 }
202 }
203}
204
205void DocumentSwitcherPlugin::documentOpened(KDevelop::IDocument *document)
206{

Callers 1

keyReleaseEventMethod · 0.45

Calls 11

selectMethod · 0.80
documentControllerMethod · 0.80
activateDocumentMethod · 0.80
isEmptyMethod · 0.45
rowMethod · 0.45
firstMethod · 0.45
valueMethod · 0.45
closeMethod · 0.45
rowCountMethod · 0.45
indexMethod · 0.45
modelMethod · 0.45

Tested by

no test coverage detected