From: Soren Stoutner Date: Tue, 22 Oct 2024 21:31:39 +0000 (-0700) Subject: Colorize the requests counter background. https://redmine.stoutner.com/issues/1232 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=3e5f83e043df946dc063fea595b5323e9ab210d0;p=PrivacyBrowserPC.git Colorize the requests counter background. https://redmine.stoutner.com/issues/1232 --- 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