mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 11:13:53 +08:00
Cabana: Fix title overlapping on chart with long names (#26494)
fix title overlapping
This commit is contained in:
@@ -207,7 +207,6 @@ ChartView::ChartView(const QString &id, const Signal *sig, QWidget *parent)
|
||||
item_group->setZValue(chart->zValue() + 10);
|
||||
|
||||
// title
|
||||
msg_title = new QGraphicsTextItem(chart);
|
||||
QToolButton *remove_btn = new QToolButton();
|
||||
remove_btn->setText("X");
|
||||
remove_btn->setAutoRaise(true);
|
||||
@@ -236,13 +235,11 @@ ChartView::ChartView(const QString &id, const Signal *sig, QWidget *parent)
|
||||
|
||||
void ChartView::resizeEvent(QResizeEvent *event) {
|
||||
QChartView::resizeEvent(event);
|
||||
msg_title->setPos(11, 6);
|
||||
close_btn_proxy->setPos(event->size().width() - close_btn_proxy->size().width() - 11, 8);
|
||||
}
|
||||
|
||||
void ChartView::updateTitle() {
|
||||
chart()->setTitle(signal->name.c_str());
|
||||
msg_title->setHtml(tr("%1 <font color=\"gray\">%2</font>").arg(dbc()->msg(id)->name).arg(id));
|
||||
chart()->setTitle(tr("<font color=\"gray\" text-align:left>%1 %2</font> <b>%3</b>").arg(dbc()->msg(id)->name).arg(id).arg(signal->name.c_str()));
|
||||
}
|
||||
|
||||
void ChartView::updateFromSettings() {
|
||||
@@ -250,7 +247,6 @@ void ChartView::updateFromSettings() {
|
||||
chart()->setTheme(settings.chart_theme == 0 ? QChart::ChartThemeLight : QChart::QChart::ChartThemeDark);
|
||||
auto color = chart()->titleBrush().color();
|
||||
line_marker->setPen(QPen(color, 2));
|
||||
msg_title->setDefaultTextColor(color);
|
||||
}
|
||||
|
||||
void ChartView::setRange(double min, double max, bool force_update) {
|
||||
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
QGraphicsItemGroup *item_group;
|
||||
QGraphicsLineItem *line_marker, *track_line;
|
||||
QGraphicsEllipseItem *track_ellipse;
|
||||
QGraphicsTextItem *value_text, *msg_title;
|
||||
QGraphicsTextItem *value_text;
|
||||
QGraphicsProxyWidget *close_btn_proxy;
|
||||
QVector<QPointF> vals;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user