Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowstheme.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSTHEME_H
5#define QWINDOWSTHEME_H
6
7#include <qpa/qplatformtheme.h>
8
9#include <QtCore/qsharedpointer.h>
10#include <QtCore/qvariant.h>
11#include <QtCore/qlist.h>
12#include <QtCore/qsize.h>
13
15
16class QWindow;
17
19{
20 Q_DISABLE_COPY_MOVE(QWindowsTheme)
21public:
23 ~QWindowsTheme() override;
24
25 static QWindowsTheme *instance() { return m_instance; }
26
27 bool usePlatformNativeDialog(DialogType type) const override;
29#if QT_CONFIG(systemtrayicon)
31#endif
32 QVariant themeHint(ThemeHint) const override;
33
34 Qt::ColorScheme colorScheme() const override;
35
36 const QPalette *palette(Palette type = SystemPalette) const override
37 { return m_palettes[type]; }
38 const QFont *font(Font type = SystemFont) const override
39 { return m_fonts[type]; }
40
41 QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
42
43 QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = {}) const override;
44
46 void displayChanged() { refreshIconPixmapSizes(); }
47
48 QList<QSize> availableFileIconSizes() const { return m_fileIconSizes; }
49
51 QPlatformMenu *createPlatformMenu() const override;
53 void showPlatformMenuBar() override;
54
55 static bool useNativeMenus();
56 static bool queryDarkMode();
57 static bool queryHighContrast();
58
59 void refreshFonts();
60 void refresh();
61
62 static const char *name;
63
65
66private:
67 void clearPalettes();
68 void refreshPalettes();
69 void clearFonts();
70 void refreshIconPixmapSizes();
71
72 static QWindowsTheme *m_instance;
73 QPalette *m_palettes[NPalettes];
74 QFont *m_fonts[NFonts];
75 QList<QSize> m_fileIconSizes;
76};
77
79
80#endif // QWINDOWSTHEME_H
\inmodule QtCore \reentrant
Definition qfileinfo.h:22
\reentrant
Definition qfont.h:20
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
Definition qlist.h:74
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
The QPlatformTheme class allows customizing the UI based on themes.
virtual QPlatformSystemTrayIcon * createPlatformSystemTrayIcon() const
Factory function for QSystemTrayIcon.
ThemeHint
This enum describes the available theme hints.
\inmodule QtCore
Definition qsize.h:207
\inmodule QtCore
Definition qvariant.h:64
\inmodule QtGui
Definition qwindow.h:63
static bool useNativeMenus()
void windowsThemeChanged(QWindow *window)
void showPlatformMenuBar() override
void displayChanged()
QPlatformMenuBar * createPlatformMenuBar() const override
bool usePlatformNativeDialog(DialogType type) const override
const QFont * font(Font type=SystemFont) const override
static const char * name
QList< QSize > availableFileIconSizes() const
QPlatformMenuItem * createPlatformMenuItem() const override
const QPalette * palette(Palette type=SystemPalette) const override
Qt::ColorScheme colorScheme() const override
static QPalette systemPalette(Qt::ColorScheme)
QVariant themeHint(ThemeHint) const override
~QWindowsTheme() override
static bool queryHighContrast()
static bool queryDarkMode()
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={}) const override
Return an icon for fileInfo, observing iconOptions.
QPlatformDialogHelper * createPlatformDialogHelper(DialogType type) const override
static QWindowsTheme * instance()
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override
QPlatformMenu * createPlatformMenu() const override
Combined button and popup list for selecting options.
ColorScheme
Definition qnamespace.h:49
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum type
#define sp
aWidget window() -> setWindowTitle("New Window Title")
[2]