Increase contrast of chat scrollbar thumb only

This commit is contained in:
evgeny committed 2026-10-21 13:21:30 +02:00
1 parent 4f6808156f
commit 4dbc543cd3
1 file changed
+19
+19
View File
@@ -9,6 +9,23 @@
#include <QMouseEvent>
#include <QKeyEvent>
#include <QScrollBar>
#include <QStyleOptionSlider>
/* Перерисовываем светлее только ползунок; дорожку и стрелки рисует стандартный стиль. */
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<QString> 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);