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

Method addModel

plugins/problemreporter/problemsview.cpp:410–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410void ProblemsView::addModel(const ModelData& newData)
411{
412 // We implement follows tabs order:
413 //
414 // 1) First tab always used by "Parser" model due to it's the most important
415 // problem listing, it should be at the front (K.Funk idea at #kdevelop IRC channel).
416 //
417 // 2) Other tabs are alphabetically ordered.
418
419 const QString parserId = QStringLiteral("Parser");
420
421 auto model = newData.model;
422 auto view = new ProblemTreeView(nullptr, model);
423 connect(view, &ProblemTreeView::changed, this, &ProblemsView::onViewChanged);
424 connect(model, &ProblemModel::fullUpdateTooltipChanged,
425 this, [this, model]() {
426 if (currentView()->model() == model) {
427 m_fullUpdateAction->setToolTip(model->fullUpdateTooltip());
428 }
429 });
430
431 int insertIdx = 0;
432 if (newData.id != parserId) {
433 for (insertIdx = 0; insertIdx < m_models.size(); ++insertIdx) {
434 const ModelData& currentData = m_models[insertIdx];
435
436 // Skip first element if it's already occupied by "Parser" model
437 if (insertIdx == 0 && currentData.id == parserId)
438 continue;
439
440 if (currentData.name.localeAwareCompare(newData.name) > 0)
441 break;
442 }
443 }
444 m_tabWidget->insertTab(insertIdx, view, newData.name);
445 m_models.insert(insertIdx, newData);
446
447 updateTab(insertIdx, model->rowCount());
448}
449
450void ProblemsView::updateTab(int idx, int rows)
451{

Callers 7

CompileAnalyzerMethod · 0.45
ProblemModelMethod · 0.45
PluginMethod · 0.45
PluginMethod · 0.45
ProblemReporterPluginMethod · 0.45
initTestCaseMethod · 0.45
testAddModelMethod · 0.45

Calls 6

setToolTipMethod · 0.80
fullUpdateTooltipMethod · 0.80
modelMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
rowCountMethod · 0.45

Tested by 4

PluginMethod · 0.36
PluginMethod · 0.36
initTestCaseMethod · 0.36
testAddModelMethod · 0.36