| 1288 | } |
| 1289 | |
| 1290 | void DAPDebugger::initializeVairablesPane() |
| 1291 | { |
| 1292 | d->variablesPane = new DSplitter; |
| 1293 | d->localsView = new DTreeView(d->variablesPane); |
| 1294 | d->localsView->setModel(&d->localsModel); |
| 1295 | d->localsView->setUniformRowHeights(true); |
| 1296 | d->localsView->setItemDelegate(new BaseItemDelegate(this)); |
| 1297 | |
| 1298 | d->watchsView = new DTreeView(d->variablesPane); |
| 1299 | d->watchsView->setModel(&d->watchsModel); |
| 1300 | d->watchsView->setUniformRowHeights(true); |
| 1301 | d->watchsView->setItemDelegate(new BaseItemDelegate(this)); |
| 1302 | d->variablesPane->addWidget(d->localsView); |
| 1303 | d->variablesPane->addWidget(d->watchsView); |
| 1304 | d->variablesPane->setOrientation(Qt::Vertical); |
| 1305 | d->variablesPane->setChildrenCollapsible(false); |
| 1306 | |
| 1307 | d->watchsView->setContextMenuPolicy(Qt::CustomContextMenu); |
| 1308 | d->watchsView->setSelectionBehavior(QAbstractItemView::SelectRows); |
| 1309 | |
| 1310 | DMenu *menu = new DMenu(d->watchsView); |
| 1311 | QAction *evaluateWatchVariable = new QAction(tr("Add New Expression Evaluator"), d->watchsView); |
| 1312 | QAction *remove = new QAction(tr("Remove This Evaluator"), d->watchsView); |
| 1313 | |
| 1314 | menu->addAction(evaluateWatchVariable); |
| 1315 | menu->addAction(remove); |
| 1316 | connect(d->watchsView, &DTreeView::customContextMenuRequested, this, [=](const QPoint &pos) { |
| 1317 | auto index = d->watchsView->indexAt(pos); |
| 1318 | if (index.isValid() && d->watchsView->selectionModel()->selectedRows().size() == 1) |
| 1319 | remove->setEnabled(true); |
| 1320 | else |
| 1321 | remove->setEnabled(false); |
| 1322 | menu->exec(d->watchsView->mapToGlobal(pos)); |
| 1323 | }); |
| 1324 | |
| 1325 | connect(evaluateWatchVariable, &QAction::triggered, this, &DAPDebugger::slotEvaluateWatchVariable); |
| 1326 | connect(remove, &QAction::triggered, this, &DAPDebugger::slotRemoveEvaluator); |
| 1327 | |
| 1328 | QStringList headers { tr("Name"), tr("Value"), tr("Type") /*, "Reference" */ }; |
| 1329 | d->localsModel.setHeaders(headers); |
| 1330 | d->watchsModel.setHeaders(headers); |
| 1331 | |
| 1332 | d->variablesSpinner = new DSpinner(d->localsView); |
| 1333 | d->variablesSpinner->setFixedSize(30, 30); |
| 1334 | d->variablesSpinner->start(); |
| 1335 | d->variablesSpinner->hide(); |
| 1336 | } |
| 1337 | |
| 1338 | void DAPDebugger::updateWatchingVariables() |
| 1339 | { |
nothing calls this directly
no test coverage detected