Fix theming with Qt 5.15

* Fixes #4765
* Fixes #4766
This commit is contained in:
Jonathan White 2020-06-04 08:10:43 -04:00
parent 6f5e13815c
commit 2073f2ddc3
11 changed files with 149 additions and 128 deletions

View File

@ -68,26 +68,6 @@ Application::Application(int& argc, char** argv)
registerUnixSignals();
#endif
QString appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
if (appTheme == "auto") {
if (osUtils->isDarkMode()) {
setStyle(new DarkStyle);
m_darkTheme = true;
} else {
setStyle(new LightStyle);
}
} else if (appTheme == "light") {
setStyle(new LightStyle);
} else if (appTheme == "dark") {
setStyle(new DarkStyle);
m_darkTheme = true;
} else {
// Classic mode, only check for dark theme when not on Windows
#ifndef Q_OS_WIN
m_darkTheme = osUtils->isDarkMode();
#endif
}
QString userName = qgetenv("USER");
if (userName.isEmpty()) {
userName = qgetenv("USERNAME");
@ -162,6 +142,32 @@ Application::~Application()
}
}
void Application::applyTheme()
{
QString appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
if (appTheme == "auto") {
if (osUtils->isDarkMode()) {
setStyle(new DarkStyle);
m_darkTheme = true;
} else {
setStyle(new LightStyle);
}
} else if (appTheme == "light") {
setStyle(new LightStyle);
} else if (appTheme == "dark") {
setStyle(new DarkStyle);
m_darkTheme = true;
} else {
// Classic mode, don't check for dark theme on Windows
// because Qt 5.x does not support it
#ifndef Q_OS_WIN
m_darkTheme = osUtils->isDarkMode();
#endif
}
setPalette(style()->standardPalette());
}
bool Application::event(QEvent* event)
{
// Handle Apple QFileOpenEvent from finder (double click on .kdbx file)

View File

@ -39,6 +39,8 @@ public:
Application(int& argc, char** argv);
~Application() override;
void applyTheme();
bool event(QEvent* event) override;
bool isAlreadyRunning() const;
bool isDarkTheme() const;

View File

@ -397,7 +397,6 @@ namespace Phantom
colors[S_button] = Dc::adjustLightness(colors[S_button], 0.01);
colors[S_base] = pal.color(QPalette::Base);
colors[S_text] = pal.color(QPalette::Text);
colors[S_text] = pal.color(QPalette::WindowText);
colors[S_windowText] = pal.color(QPalette::WindowText);
colors[S_highlight] = pal.color(QPalette::Highlight);
colors[S_highlightedText] = pal.color(QPalette::HighlightedText);
@ -4622,11 +4621,13 @@ int BaseStyle::styleHint(StyleHint hint,
case SH_Table_GridLineColor: {
using namespace Phantom::SwatchColors;
namespace Ph = Phantom;
if (!option)
return 0;
auto ph_swatchPtr = Ph::getCachedSwatchOfQPalette(&d->swatchCache, &d->headSwatchFastKey, option->palette);
const Ph::PhSwatch& swatch = *ph_swatchPtr.data();
// Qt code in table views for drawing grid lines is broken. See case for
// CE_ItemViewItem painting for more information.
return option ? static_cast<int>(swatch.color(S_base_divider).rgb()) : 0;
return static_cast<int>(swatch.color(S_base_divider).rgb());
}
case SH_MessageBox_TextInteractionFlags:
return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse;

View File

@ -23,67 +23,70 @@
#include <QMenuBar>
#include <QToolBar>
void DarkStyle::polish(QPalette& palette)
QPalette DarkStyle::standardPalette() const
{
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#3B3B3D"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#404042"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#424242"));
auto palette = BaseStyle::standardPalette();
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0x3B3B3D));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0x404042));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0x424242));
palette.setColor(QPalette::Active, QPalette::WindowText, QStringLiteral("#CACBCE"));
palette.setColor(QPalette::Inactive, QPalette::WindowText, QStringLiteral("#C8C8C6"));
palette.setColor(QPalette::Disabled, QPalette::WindowText, QStringLiteral("#707070"));
palette.setColor(QPalette::Active, QPalette::WindowText, QRgb(0xCACBCE));
palette.setColor(QPalette::Inactive, QPalette::WindowText, QRgb(0xC8C8C6));
palette.setColor(QPalette::Disabled, QPalette::WindowText, QRgb(0x707070));
palette.setColor(QPalette::Active, QPalette::Text, QStringLiteral("#CACBCE"));
palette.setColor(QPalette::Inactive, QPalette::Text, QStringLiteral("#C8C8C6"));
palette.setColor(QPalette::Disabled, QPalette::Text, QStringLiteral("#707070"));
palette.setColor(QPalette::Active, QPalette::Text, QRgb(0xCACBCE));
palette.setColor(QPalette::Inactive, QPalette::Text, QRgb(0xC8C8C6));
palette.setColor(QPalette::Disabled, QPalette::Text, QRgb(0x707070));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
palette.setColor(QPalette::Active, QPalette::PlaceholderText, QStringLiteral("#7D7D82"));
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, QStringLiteral("#87888C"));
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, QStringLiteral("#737373"));
palette.setColor(QPalette::Active, QPalette::PlaceholderText, QRgb(0x7D7D82));
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, QRgb(0x87888C));
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, QRgb(0x737373));
#endif
palette.setColor(QPalette::Active, QPalette::BrightText, QStringLiteral("#252627"));
palette.setColor(QPalette::Inactive, QPalette::BrightText, QStringLiteral("#2D2D2F"));
palette.setColor(QPalette::Disabled, QPalette::BrightText, QStringLiteral("#333333"));
palette.setColor(QPalette::Active, QPalette::BrightText, QRgb(0x252627));
palette.setColor(QPalette::Inactive, QPalette::BrightText, QRgb(0x2D2D2F));
palette.setColor(QPalette::Disabled, QPalette::BrightText, QRgb(0x333333));
palette.setColor(QPalette::Active, QPalette::Base, QStringLiteral("#27272A"));
palette.setColor(QPalette::Inactive, QPalette::Base, QStringLiteral("#2A2A2D"));
palette.setColor(QPalette::Disabled, QPalette::Base, QStringLiteral("#343437"));
palette.setColor(QPalette::Active, QPalette::Base, QRgb(0x27272A));
palette.setColor(QPalette::Inactive, QPalette::Base, QRgb(0x2A2A2D));
palette.setColor(QPalette::Disabled, QPalette::Base, QRgb(0x343437));
palette.setColor(QPalette::Active, QPalette::AlternateBase, QStringLiteral("#2C2C30"));
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, QStringLiteral("#2B2B2F"));
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, QStringLiteral("#36363A"));
palette.setColor(QPalette::Active, QPalette::AlternateBase, QRgb(0x2C2C30));
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, QRgb(0x2B2B2F));
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, QRgb(0x36363A));
palette.setColor(QPalette::All, QPalette::ToolTipBase, QStringLiteral("#2D532D"));
palette.setColor(QPalette::All, QPalette::ToolTipText, QStringLiteral("#BFBFBF"));
palette.setColor(QPalette::All, QPalette::ToolTipBase, QRgb(0x2D532D));
palette.setColor(QPalette::All, QPalette::ToolTipText, QRgb(0xBFBFBF));
palette.setColor(QPalette::Active, QPalette::Button, QStringLiteral("#28282B"));
palette.setColor(QPalette::Inactive, QPalette::Button, QStringLiteral("#28282B"));
palette.setColor(QPalette::Disabled, QPalette::Button, QStringLiteral("#2B2A2A"));
palette.setColor(QPalette::Active, QPalette::Button, QRgb(0x28282B));
palette.setColor(QPalette::Inactive, QPalette::Button, QRgb(0x28282B));
palette.setColor(QPalette::Disabled, QPalette::Button, QRgb(0x2B2A2A));
palette.setColor(QPalette::Active, QPalette::ButtonText, QStringLiteral("#B9B9BE"));
palette.setColor(QPalette::Inactive, QPalette::ButtonText, QStringLiteral("#9E9FA5"));
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QStringLiteral("#73747E"));
palette.setColor(QPalette::Active, QPalette::ButtonText, QRgb(0xB9B9BE));
palette.setColor(QPalette::Inactive, QPalette::ButtonText, QRgb(0x9E9FA5));
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QRgb(0x73747E));
palette.setColor(QPalette::Active, QPalette::Highlight, QStringLiteral("#2D532D"));
palette.setColor(QPalette::Inactive, QPalette::Highlight, QStringLiteral("#354637"));
palette.setColor(QPalette::Disabled, QPalette::Highlight, QStringLiteral("#293D29"));
palette.setColor(QPalette::Active, QPalette::Highlight, QRgb(0x2D532D));
palette.setColor(QPalette::Inactive, QPalette::Highlight, QRgb(0x354637));
palette.setColor(QPalette::Disabled, QPalette::Highlight, QRgb(0x293D29));
palette.setColor(QPalette::Active, QPalette::HighlightedText, QStringLiteral("#CCCCCC"));
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, QStringLiteral("#CECECE"));
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, QStringLiteral("#707070"));
palette.setColor(QPalette::Active, QPalette::HighlightedText, QRgb(0xCCCCCC));
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, QRgb(0xCECECE));
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, QRgb(0x707070));
palette.setColor(QPalette::All, QPalette::Light, QStringLiteral("#414145"));
palette.setColor(QPalette::All, QPalette::Midlight, QStringLiteral("#39393C"));
palette.setColor(QPalette::All, QPalette::Mid, QStringLiteral("#2F2F32"));
palette.setColor(QPalette::All, QPalette::Dark, QStringLiteral("#202022"));
palette.setColor(QPalette::All, QPalette::Shadow, QStringLiteral("#19191A"));
palette.setColor(QPalette::All, QPalette::Light, QRgb(0x414145));
palette.setColor(QPalette::All, QPalette::Midlight, QRgb(0x39393C));
palette.setColor(QPalette::All, QPalette::Mid, QRgb(0x2F2F32));
palette.setColor(QPalette::All, QPalette::Dark, QRgb(0x202022));
palette.setColor(QPalette::All, QPalette::Shadow, QRgb(0x19191A));
palette.setColor(QPalette::All, QPalette::Link, QStringLiteral("#68B668"));
palette.setColor(QPalette::Disabled, QPalette::Link, QStringLiteral("#74A474"));
palette.setColor(QPalette::All, QPalette::LinkVisited, QStringLiteral("#75B875"));
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, QStringLiteral("#77A677"));
palette.setColor(QPalette::All, QPalette::Link, QRgb(0x68B668));
palette.setColor(QPalette::Disabled, QPalette::Link, QRgb(0x74A474));
palette.setColor(QPalette::All, QPalette::LinkVisited, QRgb(0x75B875));
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, QRgb(0x77A677));
return palette;
}
QString DarkStyle::getAppStyleSheet() const
@ -106,18 +109,18 @@ void DarkStyle::polish(QWidget* widget)
// Let the Cocoa platform plugin draw its own background
palette.setColor(QPalette::All, QPalette::Window, Qt::transparent);
} else {
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#2A2A2A"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#2D2D2D"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#2A2A2A"));
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0x2A2A2A));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0x2D2D2D));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0x2A2A2A));
}
#elif defined(Q_OS_WIN)
// Register event filter for better dark mode support
WinUtils::registerEventFilters();
palette.setColor(QPalette::All, QPalette::Window, QStringLiteral("#2F2F30"));
palette.setColor(QPalette::All, QPalette::Window, QRgb(0x2F2F30));
#else
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#2F2F30"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#313133"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#3A3A3B"));
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0x2F2F30));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0x313133));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0x3A3A3B));
#endif
widget->setPalette(palette);

View File

@ -26,8 +26,9 @@ class DarkStyle : public BaseStyle
Q_OBJECT
public:
QPalette standardPalette() const override;
using BaseStyle::polish;
void polish(QPalette& palette) override;
void polish(QWidget* widget) override;
protected:

View File

@ -24,67 +24,70 @@
#include <QMenuBar>
#include <QToolBar>
void LightStyle::polish(QPalette& palette)
QPalette LightStyle::standardPalette() const
{
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#F7F7F7"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#FCFCFC"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#EDEDED"));
auto palette = BaseStyle::standardPalette();
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0xF7F7F7));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0xFCFCFC));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0xEDEDED));
palette.setColor(QPalette::Active, QPalette::WindowText, QStringLiteral("#1D1D20"));
palette.setColor(QPalette::Inactive, QPalette::WindowText, QStringLiteral("#252528"));
palette.setColor(QPalette::Disabled, QPalette::WindowText, QStringLiteral("#8C8C92"));
palette.setColor(QPalette::Active, QPalette::WindowText, QRgb(0x1D1D20));
palette.setColor(QPalette::Inactive, QPalette::WindowText, QRgb(0x252528));
palette.setColor(QPalette::Disabled, QPalette::WindowText, QRgb(0x8C8C92));
palette.setColor(QPalette::Active, QPalette::Text, QStringLiteral("#1D1D20"));
palette.setColor(QPalette::Inactive, QPalette::Text, QStringLiteral("#252528"));
palette.setColor(QPalette::Disabled, QPalette::Text, QStringLiteral("#8C8C92"));
palette.setColor(QPalette::Active, QPalette::Text, QRgb(0x1D1D20));
palette.setColor(QPalette::Inactive, QPalette::Text, QRgb(0x252528));
palette.setColor(QPalette::Disabled, QPalette::Text, QRgb(0x8C8C92));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
palette.setColor(QPalette::Active, QPalette::PlaceholderText, QStringLiteral("#71727D"));
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, QStringLiteral("#878893"));
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, QStringLiteral("#A3A4AC"));
palette.setColor(QPalette::Active, QPalette::PlaceholderText, QRgb(0x71727D));
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, QRgb(0x878893));
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, QRgb(0xA3A4AC));
#endif
palette.setColor(QPalette::Active, QPalette::BrightText, QStringLiteral("#F3F3F4"));
palette.setColor(QPalette::Inactive, QPalette::BrightText, QStringLiteral("#EAEAEB"));
palette.setColor(QPalette::Disabled, QPalette::BrightText, QStringLiteral("#E4E5E7"));
palette.setColor(QPalette::Active, QPalette::BrightText, QRgb(0xF3F3F4));
palette.setColor(QPalette::Inactive, QPalette::BrightText, QRgb(0xEAEAEB));
palette.setColor(QPalette::Disabled, QPalette::BrightText, QRgb(0xE4E5E7));
palette.setColor(QPalette::Active, QPalette::Base, QStringLiteral("#F9F9F9"));
palette.setColor(QPalette::Inactive, QPalette::Base, QStringLiteral("#FCFCFC"));
palette.setColor(QPalette::Disabled, QPalette::Base, QStringLiteral("#EFEFF2"));
palette.setColor(QPalette::Active, QPalette::Base, QRgb(0xF9F9F9));
palette.setColor(QPalette::Inactive, QPalette::Base, QRgb(0xFCFCFC));
palette.setColor(QPalette::Disabled, QPalette::Base, QRgb(0xEFEFF2));
palette.setColor(QPalette::Active, QPalette::AlternateBase, QStringLiteral("#ECF3E8"));
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, QStringLiteral("#F1F6EE"));
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, QStringLiteral("#E1E9DD"));
palette.setColor(QPalette::Active, QPalette::AlternateBase, QRgb(0xECF3E8));
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, QRgb(0xF1F6EE));
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, QRgb(0xE1E9DD));
palette.setColor(QPalette::All, QPalette::ToolTipBase, QStringLiteral("#4D7F1A"));
palette.setColor(QPalette::All, QPalette::ToolTipText, QStringLiteral("#F9F9F9"));
palette.setColor(QPalette::All, QPalette::ToolTipBase, QRgb(0x4D7F1A));
palette.setColor(QPalette::All, QPalette::ToolTipText, QRgb(0xF9F9F9));
palette.setColor(QPalette::Active, QPalette::Button, QStringLiteral("#D4D5DD"));
palette.setColor(QPalette::Inactive, QPalette::Button, QStringLiteral("#DCDCE0"));
palette.setColor(QPalette::Disabled, QPalette::Button, QStringLiteral("#E5E5E6"));
palette.setColor(QPalette::Active, QPalette::Button, QRgb(0xD4D5DD));
palette.setColor(QPalette::Inactive, QPalette::Button, QRgb(0xDCDCE0));
palette.setColor(QPalette::Disabled, QPalette::Button, QRgb(0xE5E5E6));
palette.setColor(QPalette::Active, QPalette::ButtonText, QStringLiteral("#181A18"));
palette.setColor(QPalette::Inactive, QPalette::ButtonText, QStringLiteral("#454A54"));
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QStringLiteral("#97979B"));
palette.setColor(QPalette::Active, QPalette::ButtonText, QRgb(0x181A18));
palette.setColor(QPalette::Inactive, QPalette::ButtonText, QRgb(0x454A54));
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QRgb(0x97979B));
palette.setColor(QPalette::Active, QPalette::Highlight, QStringLiteral("#507F1F"));
palette.setColor(QPalette::Inactive, QPalette::Highlight, QStringLiteral("#A6BE8E"));
palette.setColor(QPalette::Disabled, QPalette::Highlight, QStringLiteral("#C3D5B4"));
palette.setColor(QPalette::Active, QPalette::Highlight, QRgb(0x507F1F));
palette.setColor(QPalette::Inactive, QPalette::Highlight, QRgb(0xA6BE8E));
palette.setColor(QPalette::Disabled, QPalette::Highlight, QRgb(0xC3D5B4));
palette.setColor(QPalette::Active, QPalette::HighlightedText, QStringLiteral("#FFFFFF"));
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, QStringLiteral("#252528"));
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, QStringLiteral("#8C8C92"));
palette.setColor(QPalette::Active, QPalette::HighlightedText, QRgb(0xFFFFFF));
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, QRgb(0x252528));
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, QRgb(0x8C8C92));
palette.setColor(QPalette::All, QPalette::Light, QStringLiteral("#F9F9F9"));
palette.setColor(QPalette::All, QPalette::Midlight, QStringLiteral("#E9E9EB"));
palette.setColor(QPalette::All, QPalette::Mid, QStringLiteral("#C9C9CF"));
palette.setColor(QPalette::All, QPalette::Dark, QStringLiteral("#BBBBC2"));
palette.setColor(QPalette::All, QPalette::Shadow, QStringLiteral("#6C6D79"));
palette.setColor(QPalette::All, QPalette::Light, QRgb(0xF9F9F9));
palette.setColor(QPalette::All, QPalette::Midlight, QRgb(0xE9E9EB));
palette.setColor(QPalette::All, QPalette::Mid, QRgb(0xC9C9CF));
palette.setColor(QPalette::All, QPalette::Dark, QRgb(0xBBBBC2));
palette.setColor(QPalette::All, QPalette::Shadow, QRgb(0x6C6D79));
palette.setColor(QPalette::All, QPalette::Link, QStringLiteral("#4B7B19"));
palette.setColor(QPalette::Disabled, QPalette::Link, QStringLiteral("#4F6935"));
palette.setColor(QPalette::All, QPalette::LinkVisited, QStringLiteral("#507826"));
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, QStringLiteral("#506935"));
palette.setColor(QPalette::All, QPalette::Link, QRgb(0x4B7B19));
palette.setColor(QPalette::Disabled, QPalette::Link, QRgb(0x4F6935));
palette.setColor(QPalette::All, QPalette::LinkVisited, QRgb(0x507826));
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, QRgb(0x506935));
return palette;
}
QString LightStyle::getAppStyleSheet() const
@ -107,16 +110,16 @@ void LightStyle::polish(QWidget* widget)
// Let the Cocoa platform plugin draw its own background
palette.setColor(QPalette::All, QPalette::Window, Qt::transparent);
} else {
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#D6D6D6"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#F6F6F6"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#D4D4D4"));
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0xD6D6D6));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0xF6F6F6));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0xD4D4D4));
}
#elif defined(Q_OS_WIN)
palette.setColor(QPalette::All, QPalette::Window, QStringLiteral("#FFFFFF"));
palette.setColor(QPalette::All, QPalette::Window, QRgb(0xFFFFFF));
#else
palette.setColor(QPalette::Active, QPalette::Window, QStringLiteral("#EFF0F1"));
palette.setColor(QPalette::Inactive, QPalette::Window, QStringLiteral("#EFF0F1"));
palette.setColor(QPalette::Disabled, QPalette::Window, QStringLiteral("#E1E2E4"));
palette.setColor(QPalette::Active, QPalette::Window, QRgb(0xEFF0F1));
palette.setColor(QPalette::Inactive, QPalette::Window, QRgb(0xEFF0F1));
palette.setColor(QPalette::Disabled, QPalette::Window, QRgb(0xE1E2E4));
#endif
widget->setPalette(palette);

View File

@ -26,8 +26,9 @@ class LightStyle : public BaseStyle
Q_OBJECT
public:
QPalette standardPalette() const override;
using BaseStyle::polish;
void polish(QPalette& palette) override;
void polish(QWidget* widget) override;
protected:

View File

@ -57,6 +57,7 @@ int main(int argc, char** argv)
Application::setApplicationName("KeePassXC");
Application::setApplicationVersion(KEEPASSXC_VERSION);
app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC");
app.applyTheme();
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
#endif

View File

@ -95,6 +95,7 @@ int main(int argc, char* argv[])
app.setApplicationVersion(KEEPASSXC_VERSION);
app.setQuitOnLastWindowClosed(false);
app.setAttribute(Qt::AA_Use96Dpi, true);
app.applyTheme();
QTEST_DISABLE_KEYPAD_NAVIGATION
TestGui tc;
QTEST_SET_MAIN_SOURCE_PATH

View File

@ -59,6 +59,7 @@ int main(int argc, char* argv[])
app.setApplicationVersion(KEEPASSXC_VERSION);
app.setQuitOnLastWindowClosed(false);
app.setAttribute(Qt::AA_Use96Dpi, true);
app.applyTheme();
QTEST_DISABLE_KEYPAD_NAVIGATION
TestGuiBrowser tc;
QTEST_SET_MAIN_SOURCE_PATH

View File

@ -63,6 +63,7 @@ int main(int argc, char* argv[])
app.setApplicationVersion(KEEPASSXC_VERSION);
app.setQuitOnLastWindowClosed(false);
app.setAttribute(Qt::AA_Use96Dpi, true);
app.applyTheme();
QTEST_DISABLE_KEYPAD_NAVIGATION
TestGuiFdoSecrets tc;
QTEST_SET_MAIN_SOURCE_PATH