From 3e5f83e043df946dc063fea595b5323e9ab210d0 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Tue, 22 Oct 2024 14:31:39 -0700 Subject: [PATCH] Colorize the requests counter background. https://redmine.stoutner.com/issues/1232 --- src/windows/BrowserWindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index d948104..bde4ccb 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -466,6 +466,9 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) urlToolBarPointer = toolBar(QLatin1String("url_toolbar")); bookmarksToolBarPointer = toolBar(QLatin1String("bookmarks_toolbar")); + // Set the blocked requests action pointer widget object name (required to change the background color with a style sheet). + urlToolBarPointer->widgetForAction(blockedRequestsActionPointer)->setObjectName("blocked_requests"); + // Populate the view bookmarks toolbar checkbox. connect(bookmarksToolBarPointer, SIGNAL(visibilityChanged(bool)), this, SLOT(updateViewBookmarksToolBarCheckbox(bool))); @@ -1850,6 +1853,12 @@ void BrowserWindow::updateRequestsAction(const QVector blockedRequestsVecto // Update the tool tips. blockedRequestsActionPointer->setToolTip(i18nc("Blocked requests action tool tip", "%1 Blocked Requests (Ctrl+R)", blockedRequestsVector[PrivacyWebEngineView::TOTAL])); + + // Update the blocked requests action background color. + if (blockedRequestsVector[PrivacyWebEngineView::TOTAL] > 0) + urlToolBarPointer->setStyleSheet(QLatin1String("QToolButton#blocked_requests { background-color: tomato; }")); + else + urlToolBarPointer->setStyleSheet(QLatin1String("QToolButton#blocked_requests { background-color: transparent; }")); } void BrowserWindow::updateCookiesAction(const int numberOfCookies) const -- 2.45.2