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

Method BreakpointWidget

kdevplatform/debugger/breakpoint/breakpointwidget.cpp:53–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51};
52
53BreakpointWidget::BreakpointWidget(IDebugController *controller, QWidget *parent)
54 : AutoOrientedSplitter(parent)
55 , d_ptr(new BreakpointWidgetPrivate(controller))
56{
57 Q_D(BreakpointWidget);
58
59 setWindowTitle(i18nc("@title:window", "Debugger Breakpoints"));
60 setWhatsThis(i18nc("@info:whatsthis", "Displays a list of breakpoints with "
61 "their current status. Clicking on a "
62 "breakpoint item allows you to change "
63 "the breakpoint and will take you "
64 "to the source in the editor window."));
65 setWindowIcon( QIcon::fromTheme( QStringLiteral( "media-playback-pause"), windowIcon() ) );
66
67 d->breakpointsView = new QTreeView(this);
68 d->breakpointsView->setSelectionBehavior(QAbstractItemView::SelectRows);
69 d->breakpointsView->setSelectionMode(QAbstractItemView::SingleSelection);
70 d->breakpointsView->setRootIsDecorated(false);
71 // PlaceholderItemProxyModel supports only flat models. Expanding the placeholder item
72 // triggers an assertion failure in PlaceholderItemProxyModel::rowCount(). Forbid expanding
73 // items to prevent it. None of the items has children, so expanding is useless anyway.
74 d->breakpointsView->setItemsExpandable(false);
75
76 // Enable uniform row height tree view optimizations. The checkbox in the EnableColumn makes each
77 // non-placeholder row height noticeably greater than the placeholder row height. But the several-pixel
78 // vertical space waste for the single placeholder row is well justified by less CPU time spent on calculating
79 // row heights. The documentation for the QTreeView::uniformRowHeights property even spells out the
80 // implementation details: "The height is obtained from the first item in the view. It is updated when the data
81 // changes on that item." These documentation guarantees are perfect for breakpointsView: if there is only a
82 // single placeholder item in the tree, its row height is used as the row height; when a non-placeholder item
83 // is added, the data changes and the greater non-placeholder first row height becomes used as the row height.
84 d->breakpointsView->setUniformRowHeights(true);
85
86 auto detailsContainer = new QGroupBox(i18n("Breakpoint Details"), this);
87 auto detailsLayout = new QVBoxLayout(detailsContainer);
88 d->details = new BreakpointDetails(detailsContainer);
89 detailsLayout->addWidget(d->details);
90
91 setStretchFactor(0, 2);
92
93 auto* proxyModel = new PlaceholderItemProxyModel(this);
94 proxyModel->setSourceModel(d->debugController->breakpointModel());
95 proxyModel->setColumnHint(Breakpoint::LocationColumn, i18n("New code breakpoint ..."));
96 proxyModel->setColumnHint(Breakpoint::ConditionColumn, i18n("Enter condition ..."));
97 d->breakpointsView->setModel(proxyModel);
98 connect(proxyModel, &PlaceholderItemProxyModel::dataInserted, this, &BreakpointWidget::slotDataInserted);
99 d->proxyModel = proxyModel;
100
101 connect(d->breakpointsView, &QTreeView::activated, this, &BreakpointWidget::slotOpenFile);
102 connect(d->breakpointsView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &BreakpointWidget::slotUpdateBreakpointDetail);
103 connect(d->debugController->breakpointModel(), &BreakpointModel::rowsInserted, this, &BreakpointWidget::slotUpdateBreakpointDetail);
104 connect(d->debugController->breakpointModel(), &BreakpointModel::rowsRemoved, this, &BreakpointWidget::slotUpdateBreakpointDetail);
105 connect(d->debugController->breakpointModel(), &BreakpointModel::modelReset, this, &BreakpointWidget::slotUpdateBreakpointDetail);
106 connect(d->debugController->breakpointModel(), &BreakpointModel::dataChanged, this, &BreakpointWidget::slotUpdateBreakpointDetail);
107
108
109 connect(d->debugController->breakpointModel(),
110 &BreakpointModel::hit,

Callers

nothing calls this directly

Calls 5

setSourceModelMethod · 0.80
setColumnHintMethod · 0.80
addWidgetMethod · 0.45
breakpointModelMethod · 0.45
setModelMethod · 0.45

Tested by

no test coverage detected