File indexing completed on 2024-12-15 03:45:05
0001 /* 0002 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #include "styleinfosource.h" 0008 0009 #include <QApplication> 0010 #include <QPalette> 0011 #include <QStyle> 0012 #include <QVariant> 0013 0014 using namespace KUserFeedback; 0015 0016 StyleInfoSource::StyleInfoSource() 0017 : AbstractDataSource(QStringLiteral("style")) 0018 { 0019 } 0020 0021 QString StyleInfoSource::description() const 0022 { 0023 return tr("The widget style used by the application, and information about the used color scheme."); 0024 } 0025 0026 QVariant StyleInfoSource::data() 0027 { 0028 QVariantMap m; 0029 if (qApp && qApp->style()) 0030 m.insert(QStringLiteral("style"), qApp->style()->objectName()); // QStyleFactory sets the object name to the style name 0031 m.insert(QStringLiteral("dark"), qApp->palette().color(QPalette::Window).lightness() < 128); 0032 return m; 0033 } 0034 0035 QString StyleInfoSource::name() const 0036 { 0037 return tr("Application style"); 0038 }