|
17 | 17 | #include "parsers/perf/perfparser.h"
|
18 | 18 |
|
19 | 19 | #include <QLabel>
|
| 20 | +#include <QListView> |
20 | 21 | #include <QPointer>
|
21 | 22 | #include <QProgressBar>
|
22 | 23 | #include <QSortFilterProxyModel>
|
| 24 | +#include <QStandardItemModel> |
23 | 25 | #include <QVBoxLayout>
|
24 | 26 |
|
25 | 27 | #include <KLocalizedString>
|
@@ -82,9 +84,24 @@ TimeLineWidget::TimeLineWidget(PerfParser* parser, QMenu* filterMenu, FilterAndZ
|
82 | 84 | connect(timeLineProxy, &QAbstractItemModel::rowsInserted, this, [this]() { ui->timeLineView->expandToDepth(1); });
|
83 | 85 | connect(timeLineProxy, &QAbstractItemModel::modelReset, this, [this]() { ui->timeLineView->expandToDepth(1); });
|
84 | 86 |
|
85 |
| - connect(m_parser, &PerfParser::bottomUpDataAvailable, this, [this](const Data::BottomUpResults& data) { |
86 |
| - ResultsUtil::fillEventSourceComboBox(ui->timeLineEventSource, data.costs, tr("Show timeline for %1 events.")); |
87 |
| - }); |
| 87 | + connect(m_parser, &PerfParser::bottomUpDataAvailable, this, |
| 88 | + [this, timeLineProxy](const Data::BottomUpResults& data) { |
| 89 | + ResultsUtil::fillEventSourceComboBoxMultiSelect(ui->timeLineEventSource, data.costs, |
| 90 | + tr("Show timeline for %1 events.")); |
| 91 | + |
| 92 | + auto model = qobject_cast<QStandardItemModel*>(ui->timeLineEventSource->model()); |
| 93 | + connect(ui->timeLineEventSource->model(), &QStandardItemModel::dataChanged, model, |
| 94 | + [timeLineProxy](const QModelIndex& topLeft, const QModelIndex& /*bottomRight*/, |
| 95 | + const QVector<int>& /*roles*/) { |
| 96 | + auto checkState = topLeft.data(Qt::CheckStateRole).value<Qt::CheckState>(); |
| 97 | + |
| 98 | + if (checkState == Qt::CheckState::Checked) { |
| 99 | + timeLineProxy->showCostId(topLeft.data(Qt::UserRole + 1).toUInt()); |
| 100 | + } else { |
| 101 | + timeLineProxy->hideCostId(topLeft.data(Qt::UserRole + 1).toUInt()); |
| 102 | + } |
| 103 | + }); |
| 104 | + }); |
88 | 105 |
|
89 | 106 | connect(m_parser, &PerfParser::eventsAvailable, this, [this, eventModel](const Data::EventResults& data) {
|
90 | 107 | eventModel->setData(data);
|
|
0 commit comments