Cabana: update detail view on change (#26476)

update on changed
old-commit-hash: 4ef941e954
This commit is contained in:
Dean Lee 2022-11-14 04:56:48 +08:00 committed by GitHub
parent 69d3a5f4ba
commit 27e79880ab
2 changed files with 5 additions and 4 deletions

View File

@ -89,7 +89,7 @@ DetailWidget::DetailWidget(ChartsWidget *charts, QWidget *parent) : charts(chart
QObject::connect(binary_view, &BinaryView::resizeSignal, this, &DetailWidget::resizeSignal);
QObject::connect(binary_view, &BinaryView::addSignal, this, &DetailWidget::addSignal);
QObject::connect(can, &CANMessages::updated, this, &DetailWidget::updateState);
QObject::connect(can, &CANMessages::msgsReceived, this, &DetailWidget::updateState);
QObject::connect(dbc(), &DBCManager::DBCFileChanged, [this]() { dbcMsgChanged(); });
QObject::connect(tabbar, &QTabBar::customContextMenuRequested, this, &DetailWidget::showTabBarContextMenu);
QObject::connect(tabbar, &QTabBar::currentChanged, [this](int index) {
@ -179,9 +179,10 @@ void DetailWidget::dbcMsgChanged(int show_form_idx) {
QTimer::singleShot(1, [this]() { setUpdatesEnabled(true); });
}
void DetailWidget::updateState() {
void DetailWidget::updateState(const QHash<QString, CanData> * msgs) {
time_label->setText(QString::number(can->currentSec(), 'f', 3));
if (msg_id.isEmpty()) return;
if (!msgs->contains(msg_id))
return;
binary_view->updateState();
history_log->updateState();

View File

@ -36,7 +36,7 @@ private:
void removeSignal(const Signal *sig);
void editMsg();
void removeMsg();
void updateState();
void updateState(const QHash<QString, CanData> * msgs);
QString msg_id;
QLabel *name_label, *time_label, *warning_label;