From da19d199b9a801436d0bc93aa86fbf5fbcb6bb46 Mon Sep 17 00:00:00 2001 From: Louis Moureaux <m_louis30@yahoo.com> Date: Sun, 20 Mar 2022 01:07:48 +0100 Subject: [PATCH] Remove custom text processing in top_bar_widget Simplifies the code. See #940. --- client/gui-qt/top_bar.cpp | 17 +---------------- client/gui-qt/top_bar.h | 4 ---- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/client/gui-qt/top_bar.cpp b/client/gui-qt/top_bar.cpp index e53d8ca6d6..afbd692087 100644 --- a/client/gui-qt/top_bar.cpp +++ b/client/gui-qt/top_bar.cpp @@ -61,7 +61,7 @@ top_bar_widget::top_bar_widget(const QString &label, const QString &pg, pfcn_bool func, standards type) : QToolButton(), blink(false), keep_blinking(false), standard(type), page(pg), hover(false), right_click(nullptr), wheel_down(nullptr), - wheel_up(nullptr), left_click(func), desc(label) + wheel_up(nullptr), left_click(func) { setText(label); setToolButtonStyle(Qt::ToolButtonTextBesideIcon); @@ -95,11 +95,6 @@ void top_bar_widget::setTooltip(const QString &tooltip) setToolTip(tooltip); } -/** - Sets default label on bottom of sidewidget - */ -void top_bar_widget::setLabel(const QString &str) { desc = str; } - /** Paint event for sidewidget */ @@ -116,12 +111,9 @@ void top_bar_widget::paintEvent(QPaintEvent *event) } p.begin(this); - p.setFont(sfont); pen.setColor(QColor(232, 255, 0)); p.setPen(pen); - const auto rect = QRectF(0, 0, width(), height()); - if (standard == SW_TAX && !client_is_global_observer()) { pos = 0; int d, modulo; @@ -176,13 +168,6 @@ void top_bar_widget::paintEvent(QPaintEvent *event) p.drawPixmap(pos, 5, *sprite); } - p.setPen(palette().color(QPalette::Text)); - if (!custom_label.isEmpty()) { - p.setFont(info_font); - p.drawText(rect, Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap, - custom_label); - } - // Remove 1px for the border on the right and at the bottom const auto highlight_rect = QRectF(0.5, 0, width() - 1. / devicePixelRatio(), diff --git a/client/gui-qt/top_bar.h b/client/gui-qt/top_bar.h index b9ad15a46b..27a976501b 100644 --- a/client/gui-qt/top_bar.h +++ b/client/gui-qt/top_bar.h @@ -75,10 +75,6 @@ public slots: pfcn wheel_down; pfcn wheel_up; pfcn_bool left_click; - QFont sfont; - QFont info_font; - QString custom_label; - QString desc; QTimer *timer; };