cabana: fix two ui bugs (#30327)

fix ui bugs
pull/30333/head
Dean Lee 2 years ago committed by GitHub
parent b73329092c
commit ae26280118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      tools/cabana/signalview.cc
  2. 8
      tools/cabana/videowidget.cc

@ -504,7 +504,7 @@ SignalView::SignalView(ChartsWidget *charts, QWidget *parent) : charts(charts),
QObject::connect(can, &AbstractStream::msgsReceived, this, &SignalView::updateState);
QObject::connect(tree->header(), &QHeaderView::sectionResized, [this](int logicalIndex, int oldSize, int newSize) {
if (logicalIndex == 1) {
value_column_width = newSize - delegate->button_size.width();
value_column_width = newSize;
updateState();
}
});
@ -645,8 +645,9 @@ void SignalView::updateState(const QHash<MessageId, CanData> *msgs) {
}
const static int min_max_width = QFontMetrics(delegate->minmax_font).width("-000.00") + 5;
int value_width = std::min<int>(max_value_width + min_max_width, value_column_width / 2);
QSize size(value_column_width - value_width,
int available_width = value_column_width - delegate->button_size.width();
int value_width = std::min<int>(max_value_width + min_max_width, available_width / 2);
QSize size(available_width - value_width,
delegate->button_size.height() - style()->pixelMetric(QStyle::PM_FocusFrameVMargin) * 2);
QFutureSynchronizer<void> synchronizer;
for (int i = first_visible_row; i <= last_visible_row; ++i) {

@ -140,7 +140,7 @@ QWidget *VideoWidget::createCameraWidget() {
stacked->addWidget(alert_label = new InfoLabel(this));
l->addLayout(stacked);
l->addWidget(slider = new Slider(this));
l->addWidget(slider = new Slider(w));
slider->setSingleStep(0);
setMaximumTime(can->totalSeconds());
@ -293,9 +293,9 @@ void Slider::mouseMoveEvent(QMouseEvent *e) {
double seconds = (minimum() + pos * ((maximum() - minimum()) / (double)width())) / factor;
QPixmap thumb = thumbnail(seconds);
if (!thumb.isNull()) {
int x = std::clamp(pos - thumb.width() / 2, THUMBNAIL_MARGIN, rect().right() - thumb.width() - THUMBNAIL_MARGIN);
int y = -thumb.height();
thumbnail_label.showPixmap(mapToParent({x, y}), utils::formatSeconds(seconds), thumb, alertInfo(seconds));
int x = std::clamp(pos - thumb.width() / 2, THUMBNAIL_MARGIN, width() - thumb.width() - THUMBNAIL_MARGIN + 1);
int y = -thumb.height() - THUMBNAIL_MARGIN - 6;
thumbnail_label.showPixmap(mapToParent(QPoint(x, y)), utils::formatSeconds(seconds), thumb, alertInfo(seconds));
} else {
thumbnail_label.hide();
}

Loading…
Cancel
Save