8#include <QGuiApplication>
14#include <QLoggingCategory>
16#include <QStandardPaths>
18#if QT_CONFIG(mimetype)
19#include <QMimeDatabase>
21#if QT_CONFIG(settings)
25#include <qpa/qplatformfontdatabase.h>
26#include <qpa/qplatformintegration.h>
27#include <qpa/qplatformservices.h>
28#include <qpa/qplatformdialoghelper.h>
29#include <qpa/qplatformtheme_p.h>
31#include <private/qguiapplication_p.h>
33#include <QDBusConnectionInterface>
34#include <private/qdbusplatformmenu_p.h>
35#include <private/qdbusmenubar_p.h>
36#include <private/qflatmap_p.h>
37#include <QJsonDocument>
41#include <QJsonParseError>
43#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
44#include <private/qdbustrayicon_p.h>
80#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
82 static bool dbusTrayAvailable =
false;
83 static bool dbusTrayAvailableKnown =
false;
84 if (!dbusTrayAvailableKnown) {
87 dbusTrayAvailable =
true;
88 dbusTrayAvailableKnown =
true;
89 qCDebug(qLcTray) <<
"D-Bus tray available:" << dbusTrayAvailable;
91 return dbusTrayAvailable;
103 constexpr int defaultCursorSize = 24;
105 static const int s = xCursorSize > 0 ? xCursorSize : defaultCursorSize;
114 if (
const auto iface =
connection.interface())
115 return iface->isServiceRegistered(registrarService);
122 return dbusGlobalMenuAvailable;
173 bool operator<(
const DBusKey &
other)
const
195 QFlatMap <DBusKey, ChangeSignal> m_signalMap;
201 void populateSignalMap();
226 const bool dBusRunning =
dbus.isConnected();
227 bool dBusSignalConnected =
false;
228#define LOG service << path << interface << signal;
232 qRegisterMetaType<QDBusVariant>();
237 if (dBusSignalConnected) {
243 qCWarning(lcQpaThemeDBus) <<
"DBus connection failed:" <<
LOG;
246 qCWarning(lcQpaThemeDBus) <<
"Session DBus not running.";
248 qCWarning(lcQpaThemeDBus) <<
"Application will not react to setting changes.\n"
249 <<
"Check your DBus installation.";
257#define CHECK(cond, warning)\
259 qCWarning(lcQpaThemeDBus) << fileName << warning << "Falling back to default.";\
263#define PARSE(var, enumeration, string)\
267 const int val = QMetaEnum::fromType<enumeration>().keyToValue(string.toLatin1(), &success);\
268 CHECK(success, "Parse Error: Invalid value" << string << "for" << #var);\
269 var = static_cast<enumeration>(val);\
279 CHECK(doc.
isObject(),
"Parse Error: Expected root object" << s_root);
282 CHECK(root.
contains(s_root),
"Parse Error: Expected root object" << s_root);
283 CHECK(root[s_root][s_signals].isArray(),
"Parse Error: Expected array" << s_signals);
285 const QJsonArray &sigs = root[s_root][s_signals].toArray();
286 CHECK((sigs.
count() > 0),
"Parse Error: Found empty array" << s_signals);
289 CHECK(sig->isObject(),
"Parse Error: Expected object array" << s_signals);
291 CHECK(
obj.contains(s_dbusLocation),
"Parse Error: Expected key" << s_dbusLocation);
292 CHECK(
obj.contains(s_dbusKey),
"Parse Error: Expected key" << s_dbusKey);
293 CHECK(
obj.contains(s_provider),
"Parse Error: Expected key" << s_provider);
294 CHECK(
obj.contains(s_setting),
"Parse Error: Expected key" << s_setting);
297 const QString &providerString =
obj[s_provider].toString();
298 const QString &settingString =
obj[s_setting].toString();
303 m_signalMap.
insert(dkey, ChangeSignal(provider, setting));
308 if (m_signalMap.
count() > 0)
311 qCWarning(lcQpaThemeDBus) <<
"No data imported from" <<
fileName <<
"falling back to default.";
318 qCDebug(lcQpaThemeDBus) <<
"Listening to" <<
count <<
"signals:";
320 qDebug() <<
it.key().key <<
it.key().location <<
"mapped to"
321 <<
it.value().provider <<
it.value().setting;
327void QGenericUnixThemeDBusListener::saveJson(
const QString &
fileName)
const
339 const DBusKey &dkey = sig.key();
340 const ChangeSignal &csig = sig.value();
342 obj[s_dbusLocation] = dkey.location;
343 obj[s_dbusKey] = dkey.key;
345 .valueToKey(
static_cast<int>(csig.provider)));
347 .valueToKey(
static_cast<int>(csig.setting)));
351 obj[s_signals] = sigs;
359void QGenericUnixThemeDBusListener::populateSignalMap()
363 if (!loadJsonFile.isEmpty())
364 loadJson(loadJsonFile);
368 m_signalMap.
insert(DBusKey(
"org.kde.kdeglobals.KDE"_L1,
"widgetStyle"_L1),
371 m_signalMap.
insert(DBusKey(
"org.kde.kdeglobals.General"_L1,
"ColorScheme"_L1),
374 m_signalMap.
insert(DBusKey(
"org.gnome.desktop.interface"_L1,
"gtk-theme"_L1),
377 m_signalMap.
insert(DBusKey(
"org.freedesktop.appearance"_L1,
"color-scheme"_L1),
381 if (!saveJsonFile.isEmpty())
382 saveJson(saveJsonFile);
385std::optional<QGenericUnixThemeDBusListener::ChangeSignal>
389 std::optional<QGenericUnixThemeDBusListener::ChangeSignal>
ret;
391 ret.emplace(m_signalMap.
value(dkey));
399 if (!sig.has_value())
433 return &
d->systemFont;
435 return &
d->fixedFont;
447 if (homeIconDir.isDir())
448 paths.prepend(homeIconDir.absoluteFilePath());
461 if (pixmapsIconsDir.isDir())
462 paths.append(pixmapsIconsDir.absoluteFilePath());
476#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
521#if QT_CONFIG(mimetype)
539#if QT_CONFIG(settings)
544 enum class KdeSettingType {
554 enum class KdeSetting {
558 ShowIconsOnPushButtons,
578 ViewBackgroundAlternate,
581 ViewForegroundVisited,
586 QKdeThemePrivate(
const QStringList &kdeDirs,
int kdeVersion);
591 return kdeDir +
"/kdeglobals"_L1;
592 return kdeDir +
"/share/config/kdeglobals"_L1;
597 QVariant readKdeSetting(KdeSetting
s)
const;
598 void clearKdeSettings()
const;
599 static void readKdeSystemPalette(
const QStringList &kdeDirs,
int kdeVersion, QHash<QString, QSettings*> &kdeSettings,
QPalette *pal);
604 const int kdeVersion;
611 int toolBarIconSize = 0;
612 bool singleClick =
true;
613 bool showIconsOnPushButtons =
true;
614 int wheelScrollLines = 3;
615 int doubleClickInterval = 400;
616 int startDragDist = 10;
617 int startDragTime = 500;
618 int cursorBlinkRate = 1000;
623 mutable QHash<QString, QSettings *> kdeSettings;
625 std::unique_ptr<QGenericUnixThemeDBusListener>
dbus;
643 qCDebug(lcQpaThemeDBus) <<
"KDE color theme changed to:" <<
value;
646 qCDebug(lcQpaThemeDBus) <<
"KDE global theme changed to:" <<
value;
649 qCDebug(lcQpaThemeDBus) <<
"KDE application style changed to:" <<
value;
656bool QKdeThemePrivate::initDbus()
665 settingChangedHandler(provider, setting,
value);
672QKdeThemePrivate::QKdeThemePrivate(
const QStringList &kdeDirs,
int kdeVersion)
673 : kdeDirs(kdeDirs), kdeVersion(kdeVersion)
683 case QKdeThemePrivate::KdeSettingType::Root:
685 case QKdeThemePrivate::KdeSettingType::KDE:
687 case QKdeThemePrivate::KdeSettingType::Fonts:
689 case QKdeThemePrivate::KdeSettingType::Colors:
691 case QKdeThemePrivate::KdeSettingType::Icons:
693 case QKdeThemePrivate::KdeSettingType::ToolBarIcons:
695 case QKdeThemePrivate::KdeSettingType::ToolBarStyle:
701static constexpr QKdeThemePrivate::KdeSettingType settingsType(QKdeThemePrivate::KdeSetting setting)
703#define CASE(s, type) case QKdeThemePrivate::KdeSetting::s:\
704 return QKdeThemePrivate::KdeSettingType::type
707 CASE(WidgetStyle, Root);
709 CASE(SingleClick, KDE);
710 CASE(ShowIconsOnPushButtons, KDE);
711 CASE(IconTheme, Icons);
712 CASE(ToolBarIconSize, ToolBarIcons);
714 CASE(WheelScrollLines, KDE);
715 CASE(DoubleClickInterval, KDE);
716 CASE(StartDragDistance, KDE);
717 CASE(StartDragTime, KDE);
718 CASE(CursorBlinkRate, KDE);
721 CASE(MenuFont, Root);
722 CASE(ToolBarFont, Root);
737 Q_UNREACHABLE_RETURN(QKdeThemePrivate::KdeSettingType::Root);
741static constexpr QLatin1StringView settingsKey(QKdeThemePrivate::KdeSetting setting)
744 case QKdeThemePrivate::KdeSetting::WidgetStyle:
746 case QKdeThemePrivate::KdeSetting::ColorScheme:
748 case QKdeThemePrivate::KdeSetting::SingleClick:
750 case QKdeThemePrivate::KdeSetting::ShowIconsOnPushButtons:
752 case QKdeThemePrivate::KdeSetting::IconTheme:
754 case QKdeThemePrivate::KdeSetting::ToolBarIconSize:
756 case QKdeThemePrivate::KdeSetting::ToolButtonStyle:
758 case QKdeThemePrivate::KdeSetting::WheelScrollLines:
760 case QKdeThemePrivate::KdeSetting::DoubleClickInterval:
762 case QKdeThemePrivate::KdeSetting::StartDragDistance:
764 case QKdeThemePrivate::KdeSetting::StartDragTime:
766 case QKdeThemePrivate::KdeSetting::CursorBlinkRate:
768 case QKdeThemePrivate::KdeSetting::Font:
770 case QKdeThemePrivate::KdeSetting::Fixed:
772 case QKdeThemePrivate::KdeSetting::MenuFont:
774 case QKdeThemePrivate::KdeSetting::ToolBarFont:
776 case QKdeThemePrivate::KdeSetting::ButtonBackground:
778 case QKdeThemePrivate::KdeSetting::WindowBackground:
780 case QKdeThemePrivate::KdeSetting::ViewForeground:
782 case QKdeThemePrivate::KdeSetting::WindowForeground:
784 case QKdeThemePrivate::KdeSetting::ViewBackground:
786 case QKdeThemePrivate::KdeSetting::SelectionBackground:
788 case QKdeThemePrivate::KdeSetting::SelectionForeground:
790 case QKdeThemePrivate::KdeSetting::ViewBackgroundAlternate:
792 case QKdeThemePrivate::KdeSetting::ButtonForeground:
794 case QKdeThemePrivate::KdeSetting::ViewForegroundLink:
796 case QKdeThemePrivate::KdeSetting::ViewForegroundVisited:
798 case QKdeThemePrivate::KdeSetting::TooltipBackground:
800 case QKdeThemePrivate::KdeSetting::TooltipForeground:
806void QKdeThemePrivate::refresh()
823 readKdeSystemPalette(kdeDirs, kdeVersion, kdeSettings, &systemPalette);
827 const QVariant styleValue = readKdeSetting(KdeSetting::WidgetStyle);
834 const QVariant colorScheme = readKdeSetting(KdeSetting::ColorScheme);
837 updateColorScheme(colorScheme.
toString());
841 const QVariant singleClickValue = readKdeSetting(KdeSetting::SingleClick);
842 if (singleClickValue.isValid())
843 singleClick = singleClickValue.toBool();
845 const QVariant showIconsOnPushButtonsValue = readKdeSetting(KdeSetting::ShowIconsOnPushButtons);
846 if (showIconsOnPushButtonsValue.isValid())
847 showIconsOnPushButtons = showIconsOnPushButtonsValue.toBool();
849 const QVariant themeValue = readKdeSetting(KdeSetting::IconTheme);
850 if (themeValue.isValid())
851 iconThemeName = themeValue.toString();
853 const QVariant toolBarIconSizeValue = readKdeSetting(KdeSetting::ToolBarIconSize);
854 if (toolBarIconSizeValue.isValid())
855 toolBarIconSize = toolBarIconSizeValue.toInt();
857 const QVariant toolbarStyleValue = readKdeSetting(KdeSetting::ToolButtonStyle);
858 if (toolbarStyleValue.isValid()) {
859 const QString toolBarStyle = toolbarStyleValue.toString();
860 if (toolBarStyle ==
"TextBesideIcon"_L1)
862 else if (toolBarStyle ==
"TextOnly"_L1)
864 else if (toolBarStyle ==
"TextUnderIcon"_L1)
868 const QVariant wheelScrollLinesValue = readKdeSetting(KdeSetting::WheelScrollLines);
869 if (wheelScrollLinesValue.isValid())
870 wheelScrollLines = wheelScrollLinesValue.toInt();
872 const QVariant doubleClickIntervalValue = readKdeSetting(KdeSetting::DoubleClickInterval);
873 if (doubleClickIntervalValue.isValid())
874 doubleClickInterval = doubleClickIntervalValue.toInt();
876 const QVariant startDragDistValue = readKdeSetting(KdeSetting::StartDragDistance);
877 if (startDragDistValue.isValid())
878 startDragDist = startDragDistValue.toInt();
880 const QVariant startDragTimeValue = readKdeSetting(KdeSetting::StartDragTime);
881 if (startDragTimeValue.isValid())
882 startDragTime = startDragTimeValue.toInt();
884 const QVariant cursorBlinkRateValue = readKdeSetting(KdeSetting::CursorBlinkRate);
885 if (cursorBlinkRateValue.isValid()) {
886 cursorBlinkRate = cursorBlinkRateValue.toInt();
887 cursorBlinkRate = cursorBlinkRate > 0 ?
qBound(200, cursorBlinkRate, 2000) : 0;
891 if (
QFont *systemFont = kdeFont(readKdeSetting(KdeSetting::Font)))
896 if (
QFont *fixedFont = kdeFont(readKdeSetting(KdeSetting::Fixed))) {
904 if (
QFont *menuFont = kdeFont(readKdeSetting(KdeSetting::MenuFont))) {
909 if (
QFont *toolBarFont = kdeFont(readKdeSetting(KdeSetting::ToolBarFont)))
919QVariant QKdeThemePrivate::readKdeSetting(KdeSetting
s,
const QStringList &kdeDirs,
int kdeVersion, QHash<QString, QSettings*> &kdeSettings)
921 for (
const QString &kdeDir : kdeDirs) {
924 const QString kdeGlobalsPath = kdeGlobals(kdeDir, kdeVersion);
927 kdeSettings.insert(kdeDir,
settings);
931 const QString key = settingsPrefix(settingsType(
s)) + settingsKey(
s);
940QVariant QKdeThemePrivate::readKdeSetting(KdeSetting
s)
const
942 return readKdeSetting(
s, kdeDirs, kdeVersion, kdeSettings);
945void QKdeThemePrivate::clearKdeSettings()
const
954 if (!
value.isValid())
963void QKdeThemePrivate::readKdeSystemPalette(
const QStringList &kdeDirs,
int kdeVersion, QHash<QString, QSettings*> &kdeSettings,
QPalette *pal)
965 if (!kdeColor(pal,
QPalette::Button, readKdeSetting(KdeSetting::ButtonBackground, kdeDirs, kdeVersion, kdeSettings))) {
967 const QColor defaultWindowBackground(214, 210, 208);
968 const QColor defaultButtonBackground(223, 220, 217);
969 *pal =
QPalette(defaultButtonBackground, defaultWindowBackground);
973 kdeColor(pal,
QPalette::Window, readKdeSetting(KdeSetting::WindowBackground, kdeDirs, kdeVersion, kdeSettings));
974 kdeColor(pal,
QPalette::Text, readKdeSetting(KdeSetting::ViewForeground, kdeDirs, kdeVersion, kdeSettings));
975 kdeColor(pal,
QPalette::WindowText, readKdeSetting(KdeSetting::WindowForeground, kdeDirs, kdeVersion, kdeSettings));
976 kdeColor(pal,
QPalette::Base, readKdeSetting(KdeSetting::ViewBackground, kdeDirs, kdeVersion, kdeSettings));
977 kdeColor(pal,
QPalette::Highlight, readKdeSetting(KdeSetting::SelectionBackground, kdeDirs, kdeVersion, kdeSettings));
978 kdeColor(pal,
QPalette::HighlightedText, readKdeSetting(KdeSetting::SelectionForeground, kdeDirs, kdeVersion, kdeSettings));
979 kdeColor(pal,
QPalette::AlternateBase, readKdeSetting(KdeSetting::ViewBackgroundAlternate, kdeDirs, kdeVersion, kdeSettings));
980 kdeColor(pal,
QPalette::ButtonText, readKdeSetting(KdeSetting::ButtonForeground, kdeDirs, kdeVersion, kdeSettings));
981 kdeColor(pal,
QPalette::Link, readKdeSetting(KdeSetting::ViewForegroundLink, kdeDirs, kdeVersion, kdeSettings));
982 kdeColor(pal,
QPalette::LinkVisited, readKdeSetting(KdeSetting::ViewForegroundVisited, kdeDirs, kdeVersion, kdeSettings));
983 kdeColor(pal,
QPalette::ToolTipBase, readKdeSetting(KdeSetting::TooltipBackground, kdeDirs, kdeVersion, kdeSettings));
984 kdeColor(pal,
QPalette::ToolTipText, readKdeSetting(KdeSetting::TooltipForeground, kdeDirs, kdeVersion, kdeSettings));
1025const char *QKdeTheme::name =
"kde";
1027QKdeTheme::QKdeTheme(
const QStringList& kdeDirs,
int kdeVersion)
1030 d_func()->refresh();
1035 if (fontValue.isValid()) {
1042 if (fontValue.userType() == QMetaType::QStringList) {
1046 fontDescription =
list.join(u
',');
1049 fontDescription = fontFamily = fontValue.toString();
1051 if (!fontDescription.isEmpty()) {
1065 for (
const QString &candidate : kdeDirs) {
1066 const QFileInfo fi(candidate + iconPath);
1068 paths.append(fi.absoluteFilePath());
1075 Q_D(
const QKdeTheme);
1080 return QVariant(
d->showIconsOnPushButtons);
1090 return QVariant(
d->iconFallbackThemeName);
1092 return QVariant(
d->kdeIconThemeSearchPaths(
d->kdeDirs));
1098 return QVariant(
int(KdeKeyboardScheme));
1104 return QVariant(
d->doubleClickInterval);
1123QIcon QKdeTheme::fileIcon(
const QFileInfo &fileInfo, QPlatformTheme::IconOptions)
const
1125#if QT_CONFIG(mimetype)
1126 return xdgFileIcon(fileInfo);
1135 return d_func()->m_colorScheme;
1160 if (systemPalette) {
1176 Q_D(
const QKdeTheme);
1177 return d->resources.palettes[
type];
1180const QFont *QKdeTheme::font(Font
type)
const
1182 Q_D(
const QKdeTheme);
1183 return d->resources.fonts[
type];
1189 const int kdeVersion = kdeVersionBA.toInt();
1206 if (!kdeHomePathVar.isEmpty())
1207 kdeDirs += kdeHomePathVar;
1210 if (!kdeDirsVar.isEmpty())
1214 if (
QFileInfo(kdeVersionHomePath).isDir())
1215 kdeDirs += kdeVersionHomePath;
1219 kdeDirs += kdeHomePath;
1225 kdeDirs += kdeSettings.value(
QStringLiteral(
"prefixes")).toStringList();
1229 if (
QFileInfo(kdeVersionPrefix).isDir())
1230 kdeDirs += kdeVersionPrefix;
1232 kdeDirs.removeDuplicates();
1233 if (kdeDirs.isEmpty()) {
1234 qWarning(
"Unable to determine KDE dirs");
1238 return new QKdeTheme(kdeDirs, kdeVersion);
1250#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
1287 qCDebug(lcQpaFonts) <<
"default fonts: system" << systemFont <<
"fixed" << fixedFont;
1296 std::unique_ptr<QGenericUnixThemeDBusListener>
dbus;
1317bool QGnomeThemePrivate::initDbus()
1332 updateColorScheme(
value);
1340 const auto oldColorScheme = m_colorScheme;
1349 if (oldColorScheme != m_colorScheme)
1402#if QT_CONFIG(mimetype)
1403 return xdgFileIcon(fileInfo);
1417 return d->systemFont;
1419 return d->fixedFont;
1440 return d_func()->m_colorScheme;
1445#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
1481#if QT_CONFIG(settings)
1496 QList<QByteArray> gtkBasedEnvironments;
1497 gtkBasedEnvironments <<
"GNOME"
1503 const QList<QByteArray> desktopNames = desktopEnvironment.
split(
':');
1504 for (
const QByteArray &desktopName : desktopNames) {
1505 if (desktopEnvironment ==
"KDE") {
1506#if QT_CONFIG(settings)
1509 }
else if (gtkBasedEnvironments.contains(desktopName)) {
1518 result.push_back(
s.startsWith(
"x-"_L1) ?
s.mid(2) :
s);
1529#include "qgenericunixthemes.moc"
const QColor & color() const
Returns the brush color.
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
The QColor class provides colors based on RGB, HSV or CMYK values.
int lightness() const noexcept
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
static QDBusConnection sessionBus()
Returns a QDBusConnection object opened with the session bus.
static QString homePath()
Returns the absolute path of the user's home directory.
void close() override
Calls QFileDevice::flush() and closes the file.
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
size_type count() const noexcept
bool contains(const Key &key) const
const_iterator constBegin() const
const_iterator constEnd() const
std::pair< iterator, bool > insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue) const
bool fromString(const QString &)
Sets this font to match the description descrip.
void setStyleHint(StyleHint, StyleStrategy=PreferDefault)
Sets the style hint and strategy to hint and strategy, respectively.
QGenericUnixThemeDBusListener()
void settingChanged(QGenericUnixThemeDBusListener::Provider provider, QGenericUnixThemeDBusListener::Setting setting, const QString &value)
QGenericUnixThemePrivate()
QVariant themeHint(ThemeHint hint) const override
static QStringList iconFallbackPaths()
const QFont * font(Font type) const override
QPlatformMenuBar * createPlatformMenuBar() const override
static QPlatformTheme * createUnixTheme(const QString &name)
Creates a UNIX theme according to the detected desktop environment.
QPlatformSystemTrayIcon * createPlatformSystemTrayIcon() const override
Factory function for QSystemTrayIcon.
static QStringList xdgIconThemePaths()
static QStringList themeNames()
void configureFonts(const QString >kFontName) const
QGnomeTheme is a theme implementation for the Gnome desktop.
QPlatformMenuBar * createPlatformMenuBar() const override
virtual QString gtkFontName() const
QVariant themeHint(ThemeHint hint) const override
QPlatformSystemTrayIcon * createPlatformSystemTrayIcon() const override
Factory function for QSystemTrayIcon.
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions={ }) const override
Return an icon for fileInfo, observing iconOptions.
Qt::ColorScheme colorScheme() const override
QString standardButtonText(int button) const override
Returns the text of a standard button.
const QFont * font(Font type) const override
static QPlatformIntegration * platformIntegration()
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
static QIcon fromTheme(const QString &name)
\inmodule QtCore\reentrant
const_iterator constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the array.
const_iterator constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
qsizetype count() const
Same as size().
void append(const QJsonValue &value)
Inserts value at the end of the array.
\inmodule QtCore\reentrant
QByteArray toJson(JsonFormat format=Indented) const
QJsonObject object() const
Returns the QJsonObject contained in the document.
bool isObject() const
Returns true if the document contains an object.
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
bool contains(const QString &key) const
Returns true if the object contains key key.
bool isEmpty() const noexcept
void push_back(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
The QPalette class contains color groups for each widget state.
const QBrush & text() const
Returns the text foreground brush of the current color group.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
const QBrush & base() const
Returns the base brush of the current color group.
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options=LocateFile)
[0]
static QStringList standardLocations(StandardLocation type)
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
float toFloat(bool *ok=nullptr) const
Returns the string converted to a float value.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
static void handleThemeChange(QWindow *window=nullptr)
QPalette * palettes[QPlatformTheme::NPalettes]
QFont * fonts[QPlatformTheme::NFonts]
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ ToolButtonTextUnderIcon
@ ToolButtonTextBesideIcon
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char * interface
DBusConnection const char DBusError * error
DBusConnection * connection
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool isDBusGlobalMenuAvailable()
#define CHECK(cond, warning)
static const char defaultFixedFontNameC[]
static const char defaultSystemFontNameC[]
static QString mouseCursorTheme()
static bool isDBusTrayAvailable()
static QList< QSize > availableXdgFileIconSizes()
#define PARSE(var, enumeration, string)
static bool checkDBusGlobalMenuAvailable()
static QSize mouseCursorSize()
#define Q_LOGGING_CATEGORY(name,...)
#define qCInfo(category,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qBound(const T &min, const T &val, const T &max)
static QString themeName()
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLsizei const GLuint * paths
GLenum const void * fontName
GLfloat GLfloat GLfloat GLfloat h
GLsizei const GLchar *const * path
static void split(QT_FT_Vector *b)
#define QStringLiteral(str)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
return device isReadable() ? device -> read(static_cast< char * >(buf), size) :-1
static QStringList styleNames()
QSettings settings("MySoft", "Star Runner")
[0]
\inmodule QtCore\reentrant