Coverage Report

Created: 2026-02-10 07:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/gui/kernel/qplatformtheme.h
Line
Count
Source
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 QPLATFORMTHEME_H
5
#define QPLATFORMTHEME_H
6
7
//
8
//  W A R N I N G
9
//  -------------
10
//
11
// This file is part of the QPA API and is not meant to be used
12
// in applications. Usage of this API may make your code
13
// source and binary incompatible with future versions of Qt.
14
//
15
16
#include <QtGui/qtguiglobal.h>
17
#include <QtCore/QObject>
18
#include <QtCore/QScopedPointer>
19
#if QT_CONFIG(shortcut)
20
#  include <QtGui/QKeySequence>
21
#endif
22
23
QT_BEGIN_NAMESPACE
24
25
class QIcon;
26
class QIconEngine;
27
class QMenu;
28
class QMenuBar;
29
class QPlatformMenuItem;
30
class QPlatformMenu;
31
class QPlatformMenuBar;
32
class QPlatformDialogHelper;
33
class QPlatformSystemTrayIcon;
34
class QPlatformThemePrivate;
35
class QVariant;
36
class QPalette;
37
class QFont;
38
class QPixmap;
39
class QSizeF;
40
class QFileInfo;
41
42
class Q_GUI_EXPORT QPlatformTheme
43
{
44
    Q_GADGET
45
0
    Q_DECLARE_PRIVATE(QPlatformTheme)
Unexecuted instantiation: QPlatformTheme::d_func()
Unexecuted instantiation: QPlatformTheme::d_func() const
46
0
47
0
public:
48
0
    Q_DISABLE_COPY_MOVE(QPlatformTheme)
49
0
50
0
    enum ThemeHint {
51
0
        CursorFlashTime,
52
0
        KeyboardInputInterval,
53
0
        MouseDoubleClickInterval,
54
0
        StartDragDistance,
55
0
        StartDragTime,
56
0
        KeyboardAutoRepeatRate,
57
0
        PasswordMaskDelay,
58
0
        StartDragVelocity,
59
0
        TextCursorWidth,
60
0
        DropShadow,
61
0
        MaximumScrollBarDragDistance,
62
0
        ToolButtonStyle,
63
0
        ToolBarIconSize,
64
0
        ItemViewActivateItemOnSingleClick,
65
0
        SystemIconThemeName,
66
0
        SystemIconFallbackThemeName,
67
0
        IconThemeSearchPaths,
68
0
        StyleNames,
69
0
        WindowAutoPlacement,
70
0
        DialogButtonBoxLayout,
71
0
        DialogButtonBoxButtonsHaveIcons,
72
0
        UseFullScreenForPopupMenu,
73
0
        KeyboardScheme,
74
0
        UiEffects,
75
0
        SpellCheckUnderlineStyle,
76
0
        TabFocusBehavior,
77
0
        IconPixmapSizes,
78
0
        PasswordMaskCharacter,
79
0
        DialogSnapToDefaultButton,
80
0
        ContextMenuOnMouseRelease,
81
0
        MousePressAndHoldInterval,
82
0
        MouseDoubleClickDistance,
83
0
        WheelScrollLines,
84
0
        TouchDoubleTapDistance,
85
0
        ShowShortcutsInContextMenus,
86
0
        IconFallbackSearchPaths,
87
0
        MouseQuickSelectionThreshold,
88
0
        InteractiveResizeAcrossScreens,
89
0
        ShowDirectoriesFirst,
90
0
        PreselectFirstFileInDirectory,
91
0
        ButtonPressKeys,
92
0
        SetFocusOnTouchRelease,
93
0
        FlickStartDistance,
94
0
        FlickMaximumVelocity,
95
0
        FlickDeceleration,
96
0
        MenuBarFocusOnAltPressRelease,
97
0
        MouseCursorTheme,
98
0
        MouseCursorSize,
99
0
        UnderlineShortcut,
100
0
        ShowIconsInMenus,
101
0
        PreferFileIconFromTheme,
102
0
        MenuSelectionWraps,
103
0
        ScrollSingleStepDistance,
104
0
    };
105
0
    Q_ENUM(ThemeHint)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::ThemeHint)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::ThemeHint)
106
0
107
0
    enum DialogType {
108
0
        FileDialog,
109
0
        ColorDialog,
110
0
        FontDialog,
111
0
        MessageDialog
112
0
    };
113
0
    Q_ENUM(DialogType)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::DialogType)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::DialogType)
114
0
115
0
    enum Palette {
116
0
        SystemPalette,
117
0
        ToolTipPalette,
118
0
        ToolButtonPalette,
119
0
        ButtonPalette,
120
0
        CheckBoxPalette,
121
0
        RadioButtonPalette,
122
0
        HeaderPalette,
123
0
        ComboBoxPalette,
124
0
        ItemViewPalette,
125
0
        MessageBoxLabelPelette,
126
0
        MessageBoxLabelPalette = MessageBoxLabelPelette,
127
0
        TabBarPalette,
128
0
        LabelPalette,
129
0
        GroupBoxPalette,
130
0
        MenuPalette,
131
0
        MenuBarPalette,
132
0
        TextEditPalette,
133
0
        TextLineEditPalette,
134
0
        NPalettes
135
0
    };
136
0
    Q_ENUM(Palette)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::Palette)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::Palette)
137
0
138
0
    enum Font {
139
0
        SystemFont,
140
0
        MenuFont,
141
0
        MenuBarFont,
142
0
        MenuItemFont,
143
0
        MessageBoxFont,
144
0
        LabelFont,
145
0
        TipLabelFont,
146
0
        StatusBarFont,
147
0
        TitleBarFont,
148
0
        MdiSubWindowTitleFont,
149
0
        DockWidgetTitleFont,
150
0
        PushButtonFont,
151
0
        CheckBoxFont,
152
0
        RadioButtonFont,
153
0
        ToolButtonFont,
154
0
        ItemViewFont,
155
0
        ListViewFont,
156
0
        HeaderViewFont,
157
0
        ListBoxFont,
158
0
        ComboMenuItemFont,
159
0
        ComboLineEditFont,
160
0
        SmallFont,
161
0
        MiniFont,
162
0
        FixedFont,
163
0
        GroupBoxTitleFont,
164
0
        TabButtonFont,
165
0
        EditorFont,
166
0
        NFonts
167
0
    };
168
0
    Q_ENUM(Font)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::Font)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::Font)
169
0
170
0
    enum StandardPixmap {  // Keep in sync with QStyle::StandardPixmap
171
0
        TitleBarMenuButton,
172
0
        TitleBarMinButton,
173
0
        TitleBarMaxButton,
174
0
        TitleBarCloseButton,
175
0
        TitleBarNormalButton,
176
0
        TitleBarShadeButton,
177
0
        TitleBarUnshadeButton,
178
0
        TitleBarContextHelpButton,
179
0
        DockWidgetCloseButton,
180
0
        MessageBoxInformation,
181
0
        MessageBoxWarning,
182
0
        MessageBoxCritical,
183
0
        MessageBoxQuestion,
184
0
        DesktopIcon,
185
0
        TrashIcon,
186
0
        ComputerIcon,
187
0
        DriveFDIcon,
188
0
        DriveHDIcon,
189
0
        DriveCDIcon,
190
0
        DriveDVDIcon,
191
0
        DriveNetIcon,
192
0
        DirOpenIcon,
193
0
        DirClosedIcon,
194
0
        DirLinkIcon,
195
0
        DirLinkOpenIcon,
196
0
        FileIcon,
197
0
        FileLinkIcon,
198
0
        ToolBarHorizontalExtensionButton,
199
0
        ToolBarVerticalExtensionButton,
200
0
        FileDialogStart,
201
0
        FileDialogEnd,
202
0
        FileDialogToParent,
203
0
        FileDialogNewFolder,
204
0
        FileDialogDetailedView,
205
0
        FileDialogInfoView,
206
0
        FileDialogContentsView,
207
0
        FileDialogListView,
208
0
        FileDialogBack,
209
0
        DirIcon,
210
0
        DialogOkButton,
211
0
        DialogCancelButton,
212
0
        DialogHelpButton,
213
0
        DialogOpenButton,
214
0
        DialogSaveButton,
215
0
        DialogCloseButton,
216
0
        DialogApplyButton,
217
0
        DialogResetButton,
218
0
        DialogDiscardButton,
219
0
        DialogYesButton,
220
0
        DialogNoButton,
221
0
        ArrowUp,
222
0
        ArrowDown,
223
0
        ArrowLeft,
224
0
        ArrowRight,
225
0
        ArrowBack,
226
0
        ArrowForward,
227
0
        DirHomeIcon,
228
0
        CommandLink,
229
0
        VistaShield,
230
0
        BrowserReload,
231
0
        BrowserStop,
232
0
        MediaPlay,
233
0
        MediaStop,
234
0
        MediaPause,
235
0
        MediaSkipForward,
236
0
        MediaSkipBackward,
237
0
        MediaSeekForward,
238
0
        MediaSeekBackward,
239
0
        MediaVolume,
240
0
        MediaVolumeMuted,
241
0
        LineEditClearButton,
242
0
        DialogYesToAllButton,
243
0
        DialogNoToAllButton,
244
0
        DialogSaveAllButton,
245
0
        DialogAbortButton,
246
0
        DialogRetryButton,
247
0
        DialogIgnoreButton,
248
0
        RestoreDefaultsButton,
249
0
        TabCloseButton,
250
0
        NStandardPixmap, // assertion value for sync with QStyle::StandardPixmap
251
0
252
0
        // do not add any values below/greater than this
253
0
        CustomBase = 0xf0000000
254
0
    };
255
0
    Q_ENUM(StandardPixmap)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::StandardPixmap)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::StandardPixmap)
256
0
257
0
    enum KeyboardSchemes
258
0
    {
259
0
        WindowsKeyboardScheme,
260
0
        MacKeyboardScheme,
261
0
        X11KeyboardScheme,
262
0
        KdeKeyboardScheme,
263
0
        GnomeKeyboardScheme,
264
0
        CdeKeyboardScheme
265
0
    };
266
0
    Q_ENUM(KeyboardSchemes)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::KeyboardSchemes)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::KeyboardSchemes)
267
0
268
0
    enum UiEffect
269
0
    {
270
0
        GeneralUiEffect = 0x1,
271
0
        AnimateMenuUiEffect = 0x2,
272
0
        FadeMenuUiEffect = 0x4,
273
0
        AnimateComboUiEffect = 0x8,
274
0
        AnimateTooltipUiEffect = 0x10,
275
0
        FadeTooltipUiEffect = 0x20,
276
0
        AnimateToolBoxUiEffect = 0x40,
277
0
        HoverEffect = 0x80
278
0
    };
279
0
    Q_ENUM(UiEffect)
Unexecuted instantiation: qt_getEnumMetaObject(QPlatformTheme::UiEffect)
Unexecuted instantiation: qt_getEnumName(QPlatformTheme::UiEffect)
280
0
281
0
    enum IconOption {
282
0
        DontUseCustomDirectoryIcons = 0x01
283
0
    };
284
0
    Q_DECLARE_FLAGS(IconOptions, IconOption)
285
0
286
0
    explicit QPlatformTheme();
287
0
    virtual ~QPlatformTheme();
288
0
289
0
    virtual QPlatformMenuItem* createPlatformMenuItem() const;
290
0
    virtual QPlatformMenu* createPlatformMenu() const;
291
0
    virtual QPlatformMenuBar* createPlatformMenuBar() const;
292
0
    virtual void showPlatformMenuBar() {}
293
294
    virtual bool usePlatformNativeDialog(DialogType type) const;
295
    virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
296
297
#ifndef QT_NO_SYSTEMTRAYICON
298
    virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const;
299
#endif
300
301
    virtual Qt::ColorScheme colorScheme() const;
302
303
    virtual const QPalette *palette(Palette type = SystemPalette) const;
304
305
    virtual const QFont *font(Font type = SystemFont) const;
306
307
    virtual QVariant themeHint(ThemeHint hint) const;
308
309
    virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
310
    virtual QIcon fileIcon(const QFileInfo &fileInfo,
311
                           QPlatformTheme::IconOptions iconOptions = { }) const;
312
    virtual QIconEngine *createIconEngine(const QString &iconName) const;
313
314
#if QT_CONFIG(shortcut)
315
    virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
316
#endif
317
318
    virtual QString standardButtonText(int button) const;
319
#if QT_CONFIG(shortcut)
320
    virtual QKeySequence standardButtonShortcut(int button) const;
321
#endif
322
    virtual void requestColorScheme(Qt::ColorScheme scheme);
323
    virtual Qt::ContrastPreference contrastPreference() const;
324
325
    static QVariant defaultThemeHint(ThemeHint hint);
326
    static QString defaultStandardButtonText(int button);
327
    static QString removeMnemonics(const QString &original);
328
    QString name() const;
329
330
protected:
331
    explicit QPlatformTheme(QPlatformThemePrivate *priv);
332
    QScopedPointer<QPlatformThemePrivate> d_ptr;
333
334
private:
335
    friend class QPlatformThemeFactory;
336
};
337
338
QT_END_NAMESPACE
339
340
#endif // QPLATFORMTHEME_H