diff options
author | Sahil Gautam <sahil@libreoffice.org> | 2024-11-05 15:25:24 +0530 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-11-06 20:50:32 +0100 |
commit | c85155cf6d43e328bfe31834a49fbfb55670e166 (patch) | |
tree | c51952e0382af8ff38418f32602223dad0509dfa /vcl/inc/qt5/QtCustomStyle.hxx | |
parent | 4bdb421440207c21bf2ea93fdf8a9494742beb08 (diff) |
tdf#158943 Libreoffice Theme Part 3: Qt Color Customization
Enable UI color customization in QT via the use of custom palettes and
custom style objects for the application, and the native widgets like
the menus and the menubar.
Menubar in `kf6` doesn't follow the set palette's colors anymore, maybe
some update from kde/qt (something to look into). Works fine for `kf5`.
ticket: https://bugs.kde.org/show_bug.cgi?id=493550
Change-Id: Ibedd6d66b8ea2855e049a85b3d51ea7e933b5c57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168901
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
Diffstat (limited to 'vcl/inc/qt5/QtCustomStyle.hxx')
-rw-r--r-- | vcl/inc/qt5/QtCustomStyle.hxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtCustomStyle.hxx b/vcl/inc/qt5/QtCustomStyle.hxx new file mode 100644 index 000000000000..feac764030a7 --- /dev/null +++ b/vcl/inc/qt5/QtCustomStyle.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <QtGui/QPainter> +#include <QtWidgets/QProxyStyle> +#include <QtWidgets/QStyleOption> + +class QtCustomStyle : public QProxyStyle +{ + inline static bool m_bDefaultPaletteLoaded = false; + inline static bool m_bIsCustomStyleSet = false; + +public: + QtCustomStyle(){}; + + void drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, + const QWidget* widget = nullptr) const override; + + static QPalette customPalette(); + static QPalette GetMenuBarPalette(); + static QPalette GetMenuPalette(); + static bool IsSystemThemeChanged(); + + static void LoadCustomStyle(bool bDarkMode); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |