Clear fields on selection of new process
This commit is contained in:
parent
95e5bb7baf
commit
28a0c4a81b
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
Field::Field(QJsonObject field) {
|
Field::Field(QJsonObject field) {
|
||||||
this->name = field["name"].toString();
|
this->name = field["name"].toString();
|
||||||
this->type = field["field_type"].toString();
|
this->type = field["type"].toString();
|
||||||
this->value = field["value"].toString();
|
this->value = field["value"].toString();
|
||||||
auto fields = field["fields"].toArray();
|
auto fields = field["fields"].toArray();
|
||||||
for (auto field : fields) {
|
for (auto field : fields) {
|
||||||
|
@ -25,7 +25,8 @@ static QTreeWidgetItem *treeItem(const Field &field, QTreeWidget *treeWidget, QT
|
|||||||
//treeWidget->addChild(item);
|
//treeWidget->addChild(item);
|
||||||
}
|
}
|
||||||
item->setData(0, Qt::DisplayRole, field.name);
|
item->setData(0, Qt::DisplayRole, field.name);
|
||||||
item->setData(1, Qt::DisplayRole, field.value);
|
item->setData(1, Qt::DisplayRole, field.type);
|
||||||
|
item->setData(2, Qt::DisplayRole, field.value);
|
||||||
for (const auto &f : field.fields) {
|
for (const auto &f : field.fields) {
|
||||||
treeItem(f, treeWidget, item);
|
treeItem(f, treeWidget, item);
|
||||||
}
|
}
|
||||||
@ -48,6 +49,8 @@ TraceView::TraceView(QWidget *parent): QWidget(parent) {
|
|||||||
m_eventTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
m_eventTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
connect(m_eventTable->selectionModel(), &QItemSelectionModel::selectionChanged,
|
connect(m_eventTable->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
[this](const QItemSelection &selected, const QItemSelection &deselected) {
|
[this](const QItemSelection &selected, const QItemSelection &deselected) {
|
||||||
|
m_frameTableModel->clear();
|
||||||
|
m_fieldView->clear();
|
||||||
auto indexes = selected.indexes();
|
auto indexes = selected.indexes();
|
||||||
if (indexes.size()) {
|
if (indexes.size()) {
|
||||||
m_selectedEvent = indexes[0].row();
|
m_selectedEvent = indexes[0].row();
|
||||||
@ -75,7 +78,7 @@ TraceView::TraceView(QWidget *parent): QWidget(parent) {
|
|||||||
m_fieldView = new QTreeWidget(this);
|
m_fieldView = new QTreeWidget(this);
|
||||||
m_fieldView->header()->setStretchLastSection(true);
|
m_fieldView->header()->setStretchLastSection(true);
|
||||||
m_fieldView->setSelectionMode(QAbstractItemView::NoSelection);
|
m_fieldView->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
m_fieldView->setHeaderLabels({tr("Name"), tr("Value")});
|
m_fieldView->setHeaderLabels({tr("Name"), tr("Type"), tr("Value")});
|
||||||
m_lowerSplitter->addWidget(m_fieldView);
|
m_lowerSplitter->addWidget(m_fieldView);
|
||||||
|
|
||||||
|
|
||||||
@ -120,6 +123,7 @@ void TraceView::writeState() {
|
|||||||
void TraceView::setProcessData(ProcessData *data) {
|
void TraceView::setProcessData(ProcessData *data) {
|
||||||
m_model->setProcessData(data);
|
m_model->setProcessData(data);
|
||||||
m_frameTableModel->clear();
|
m_frameTableModel->clear();
|
||||||
|
m_fieldView->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceView::handleFrameSelection(const QItemSelection &selected, const QItemSelection &deselected) {
|
void TraceView::handleFrameSelection(const QItemSelection &selected, const QItemSelection &deselected) {
|
||||||
|
Loading…
Reference in New Issue
Block a user