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

Method renewModel

plugins/grepview/grepoutputview.cpp:209–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209GrepOutputModel* GrepOutputView::renewModel(const GrepJobSettings& settings, const QString& description)
210{
211 // clear oldest model
212 while(modelSelector->count() >= GrepOutputView::HISTORY_SIZE) {
213 QVariant var = modelSelector->itemData(GrepOutputView::HISTORY_SIZE - 1);
214 qvariant_cast<QObject*>(var)->deleteLater();
215 modelSelector->removeItem(GrepOutputView::HISTORY_SIZE - 1);
216 }
217
218 while(m_settingsHistory.count() >= GrepOutputView::HISTORY_SIZE) {
219 m_settingsHistory.removeFirst();
220 }
221
222 replacementCombo->clearEditText();
223
224 auto* newModel = new GrepOutputModel(resultsTreeView);
225 applyButton->setEnabled(false);
226 // text may be already present
227 newModel->setReplacement(replacementCombo->currentText());
228 connect(newModel, &GrepOutputModel::rowsRemoved,
229 this, &GrepOutputView::rowsRemoved);
230 connect(resultsTreeView, &QTreeView::activated, newModel, &GrepOutputModel::activate);
231 connect(replacementCombo, &KComboBox::editTextChanged, newModel, &GrepOutputModel::setReplacement);
232 connect(newModel, &GrepOutputModel::rowsInserted, this, &GrepOutputView::expandElements);
233 connect(newModel, &GrepOutputModel::showErrorMessage, this, &GrepOutputView::showErrorMessage);
234 connect(m_plugin, &GrepViewPlugin::grepJobFinished, this, &GrepOutputView::updateScrollArea);
235
236 // appends new model to history
237 modelSelector->insertItem(0, description, QVariant::fromValue<QObject*>(newModel));
238 modelSelector->setCurrentIndex(0);
239
240 m_settingsHistory.append(settings);
241
242 updateCheckable();
243
244 return newModel;
245}
246
247
248GrepOutputModel* GrepOutputView::model()

Callers 1

startSearchMethod · 0.80

Calls 7

removeItemMethod · 0.80
setReplacementMethod · 0.80
setCurrentIndexMethod · 0.80
countMethod · 0.45
itemDataMethod · 0.45
setEnabledMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected