mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-02 08:24:14 +02:00
16d89f64fd
Switching the system between light and dark while QET runs changed the palette of every plain widget but left widgets that carry a style sheet in the colors they were created with: the folio tab bar stayed light in dark mode, and after a dark-to-light switch its Add folio and chevron buttons hovered as a near-black box with the icon lost inside it. QApplication::setPalette() does not reach a widget with a style sheet; QStyleSheetStyle resolved its palette once, when the sheet was applied, and keeps it. Seventeen call sites set a sheet on a widget and five .ui files carry one, so any of them could show the stale palette. QET::Palette::refreshStyleSheets() re-applies each such widget's own sheet, which makes QStyleSheetStyle resolve it against the palette now in force. QETApp::useSystemPalette() calls it after installing the palette, so both the OS color scheme change and the "use system colors" setting are covered. tests/qttest/tst_qetpalette: a tab widget with the folio tab bar's sheet is still drawn in the old colors after setPalette(), which is the defect, and follows the palette after refreshStyleSheets(), in both directions. Fixes #943.
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "qetsbom.h"
|
|
|
|
#include <QJsonArray>
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
|
|
// Generated by cmake/generate_sbom.cmake at configure time from whatever
|
|
// find_package()/FetchContent resolution this build actually used.
|
|
#include "sbom_data.h"
|
|
|
|
QList<QetSbomComponent> QetSbom::components()
|
|
{
|
|
QList<QetSbomComponent> list;
|
|
|
|
const QJsonDocument doc = QJsonDocument::fromJson(QByteArray(qet_sbom_json));
|
|
const QJsonArray components = doc.object().value("components").toArray();
|
|
|
|
for (const QJsonValue &value : components)
|
|
{
|
|
const QJsonObject obj = value.toObject();
|
|
list.append({
|
|
obj.value("name").toString(),
|
|
obj.value("version").toString(),
|
|
obj.value("license").toString(),
|
|
obj.value("homepage").toString(),
|
|
obj.value("source").toString()
|
|
});
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
QString QetSbom::rawJson()
|
|
{
|
|
return QString::fromUtf8(qet_sbom_json);
|
|
}
|