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

Method changeModel

plugins/grepview/grepoutputview.cpp:253–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253void GrepOutputView::changeModel(int index)
254{
255 if (model()) {
256 disconnect(model(), &GrepOutputModel::showMessage,
257 this, &GrepOutputView::showMessage);
258 disconnect(model(), &GrepOutputModel::dataChanged,
259 this, &GrepOutputView::updateApplyState);
260 }
261
262 replacementCombo->clearEditText();
263
264 //after deleting the whole search history, index is -1
265 if(index >= 0)
266 {
267 QVariant var = modelSelector->itemData(index);
268 auto *resultModel = static_cast<GrepOutputModel *>(qvariant_cast<QObject*>(var));
269 resultsTreeView->setModel(resultModel);
270 resultsTreeView->expandAll();
271
272 connect(model(), &GrepOutputModel::showMessage,
273 this, &GrepOutputView::showMessage);
274 connect(model(), &GrepOutputModel::dataChanged,
275 this, &GrepOutputView::updateApplyState);
276 model()->showMessageEmit();
277 applyButton->setEnabled(model()->hasResults() &&
278 model()->getRootItem() &&
279 model()->getRootItem()->checkState() != Qt::Unchecked &&
280 !replacementCombo->currentText().isEmpty());
281 if(model()->hasResults())
282 expandElements(QModelIndex());
283 else {
284 updateButtonState(false);
285 }
286 }
287
288 updateCheckable();
289 updateApplyState(model()->index(0, 0), model()->index(0, 0));
290 m_refresh->setEnabled(true);
291 m_clearSearchHistory->setEnabled(true);
292}
293
294void GrepOutputView::setMessage(const QString& msg, MessageType type)
295{

Callers

nothing calls this directly

Calls 11

modelFunction · 0.85
showMessageEmitMethod · 0.80
hasResultsMethod · 0.80
getRootItemMethod · 0.80
checkStateMethod · 0.80
QModelIndexClass · 0.70
itemDataMethod · 0.45
setModelMethod · 0.45
setEnabledMethod · 0.45
isEmptyMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected