fix(ui): stop the platform from drawing a light band around menus
The stylesheet colours a QMenu, but a dropdown is its own native window: the margin the platform leaves around it is not part of the widget the stylesheet paints, and it is filled from the application palette. Left at the desktop default, that margin shows as a white band above and below the menu on a light theme. Giving the palette the window's own surface colour covers it, and has the useful side effect of dragging tooltips and popups onto the dark theme too. The colours are the same tokens as the stylesheet, spelled as palette roles: Qt 6 has no Menu role left, and Window is what the popup margin uses.
This commit is contained in:
4 files changed
+59
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QHash>
|
||||
#include <QMainWindow>
|
||||
#include <QPalette>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QSystemTrayIcon>
|
||||
@@ -50,6 +51,10 @@ public:
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
// Colours the stylesheet cannot reach, applied in main() before any widget
|
||||
// exists. See the definition for what leaves a light band around a menu.
|
||||
static QPalette appPalette();
|
||||
|
||||
// Installs the Flatpak files handed over by the desktop: dropped on the
|
||||
// window, or opened from the file manager ("Ouvrir avec PacManager", which
|
||||
// passes them on the command line). One install runs at a time; the rest
|
||||
|
||||
Reference in new issue
Block a user