Improve color scheme change detection

* Fix pieces bars won't correctly detect color scheme change with Qt 6.8.
* Update RSS article content view on color scheme changed.

PR #21625.
Closes #21327.
This commit is contained in:
Vladimir Golovnev
2024-10-21 09:50:53 +03:00
committed by GitHub
parent ab8d0d1dae
commit 3ab9fe55e5
3 changed files with 91 additions and 60 deletions

View File

@@ -42,7 +42,6 @@
#include "base/indexrange.h"
#include "base/path.h"
#include "base/utils/misc.h"
#include "gui/uithememanager.h"
namespace
{
@@ -119,13 +118,7 @@ PiecesBar::PiecesBar(QWidget *parent)
: QWidget(parent)
{
setMouseTracking(true);
updateColorsImpl();
connect(UIThemeManager::instance(), &UIThemeManager::themeChanged, this, [this]
{
updateColors();
redraw();
});
}
void PiecesBar::setTorrent(const BitTorrent::Torrent *torrent)
@@ -143,12 +136,19 @@ void PiecesBar::clear()
bool PiecesBar::event(QEvent *e)
{
if (e->type() == QEvent::ToolTip)
const QEvent::Type eventType = e->type();
if (eventType == QEvent::ToolTip)
{
showToolTip(static_cast<QHelpEvent *>(e));
return true;
}
if (eventType == QEvent::PaletteChange)
{
updateColors();
redraw();
}
return base::event(e);
}