From 4dbc543cd3d5df30430d060e5db11990b424ca9d Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 21 Oct 2026 13:21:30 +0200 Subject: [PATCH] Increase contrast of chat scrollbar thumb only --- tools/chatgui/src/chatview.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/chatgui/src/chatview.cpp b/tools/chatgui/src/chatview.cpp index c4e6aa07..36349e82 100644 --- a/tools/chatgui/src/chatview.cpp +++ b/tools/chatgui/src/chatview.cpp @@ -9,6 +9,23 @@ #include #include #include +#include + +/* Перерисовываем светлее только ползунок; дорожку и стрелки рисует стандартный стиль. */ +class HistoryScrollBar : public QScrollBar { +public: + using QScrollBar::QScrollBar; +protected: + void paintEvent(QPaintEvent* event) override { + QScrollBar::paintEvent(event); + QStyleOptionSlider option; initStyleOption(&option); + option.subControls = QStyle::SC_ScrollBarSlider; + option.palette.setColor(QPalette::Button, QColor(80, 80, 80)); + QPainter painter(this); + painter.setClipRect(style()->subControlRect(QStyle::CC_ScrollBar, &option, QStyle::SC_ScrollBarSlider, this)); + style()->drawComplexControl(QStyle::CC_ScrollBar, &option, &painter, this); + } +}; // Текст и реакции сообщения используют общий набор анимированных значков. static QSet animatedEmojiPaths(const QModelIndex &index) { @@ -28,6 +45,8 @@ ChatView::ChatView(QWidget *parent) : QListView(parent) { setMouseTracking(true); + setVerticalScrollBar(new HistoryScrollBar(Qt::Vertical, this)); + GUI_DEBUG("history scrollbar: native style with thumb button color=#505050"); m_scrollDownBtn = new QPushButton(QStringLiteral("\u25BC"), this); m_scrollDownBtn->setFixedSize(36, 36);