![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QPlatformTheme class allows customizing the UI based on themes. More...
#include <qplatformtheme.h>
Public Member Functions | |
| QPlatformTheme () | |
| virtual | ~QPlatformTheme () |
| virtual QPlatformMenuItem * | createPlatformMenuItem () const |
| virtual QPlatformMenu * | createPlatformMenu () const |
| virtual QPlatformMenuBar * | createPlatformMenuBar () const |
| virtual void | showPlatformMenuBar () |
| virtual bool | usePlatformNativeDialog (DialogType type) const |
| virtual QPlatformDialogHelper * | createPlatformDialogHelper (DialogType type) const |
| virtual QPlatformSystemTrayIcon * | createPlatformSystemTrayIcon () const |
| Factory function for QSystemTrayIcon. | |
| virtual Qt::ColorScheme | colorScheme () const |
| virtual const QPalette * | palette (Palette type=SystemPalette) const |
| Return a color palette for type type. | |
| virtual const QFont * | font (Font type=SystemFont) const |
| virtual QVariant | themeHint (ThemeHint hint) const |
| virtual QPixmap | standardPixmap (StandardPixmap sp, const QSizeF &size) const |
| Return a pixmap for standardPixmap, at the given size. | |
| virtual QIcon | fileIcon (const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={ }) const |
| Return an icon for fileInfo, observing iconOptions. | |
| virtual QIconEngine * | createIconEngine (const QString &iconName) const |
| Factory function for the QIconEngine used by QIcon::fromTheme(). | |
| virtual QString | standardButtonText (int button) const |
| Returns the text of a standard button. | |
| virtual void | requestColorScheme (Qt::ColorScheme scheme) |
| virtual Qt::ContrastPreference | contrastPreference () const |
| virtual Qt::MotionPreference | motionPreference () const |
| QString | name () const |
Static Public Member Functions | |
| static QVariant | defaultThemeHint (ThemeHint hint) |
| static QString | defaultStandardButtonText (int button) |
| static QString | removeMnemonics (const QString &original) |
Protected Member Functions | |
| QPlatformTheme (QPlatformThemePrivate *priv) | |
Protected Attributes | |
| QScopedPointer< QPlatformThemePrivate > | d_ptr |
Friends | |
| class | QPlatformThemeFactory |
The QPlatformTheme class allows customizing the UI based on themes.
\preliminary
See the init_platform function in qguiapplication.cpp for the complete platform initialization process.
Definition at line 43 of file qplatformtheme.h.
| Enumerator | |
|---|---|
| FileDialog | |
| ColorDialog | |
| FontDialog | |
| MessageDialog | |
Definition at line 108 of file qplatformtheme.h.
| enum QPlatformTheme::Font |
Definition at line 139 of file qplatformtheme.h.
| Enumerator | |
|---|---|
| DontUseCustomDirectoryIcons | |
Definition at line 286 of file qplatformtheme.h.
| Enumerator | |
|---|---|
| WindowsKeyboardScheme | |
| MacKeyboardScheme | |
| X11KeyboardScheme | |
| KdeKeyboardScheme | |
| GnomeKeyboardScheme | |
| CdeKeyboardScheme | |
Definition at line 262 of file qplatformtheme.h.
Definition at line 116 of file qplatformtheme.h.
Definition at line 171 of file qplatformtheme.h.
This enum describes the available theme hints.
\value CursorFlashTime (int) Cursor flash time in ms, overriding QPlatformIntegration::styleHint.
\value KeyboardInputInterval (int) Keyboard input interval in ms, overriding QPlatformIntegration::styleHint.
\value MouseDoubleClickInterval (int) Mouse double click interval in ms, overriding QPlatformIntegration::styleHint.
\value MouseDoubleClickDistance (int) The maximum distance in logical pixels which the mouse can travel between clicks in order for the click sequence to be handled as a double click. The default value is 5 logical pixels.
\value MousePressAndHoldInterval (int) Mouse press and hold interval in ms, overriding QPlatformIntegration::styleHint.
\value StartDragDistance (int) Start drag distance, overriding QPlatformIntegration::styleHint.
\value StartDragTime (int) Start drag time in ms, overriding QPlatformIntegration::styleHint.
\value WheelScrollLines (int) The number of lines to scroll a widget, when the mouse wheel is rotated. The default value is 3.
\value KeyboardAutoRepeatRate (int) Keyboard auto repeat rate, overriding QPlatformIntegration::styleHint.
\value PasswordMaskDelay (int) Pass word mask delay in ms, overriding QPlatformIntegration::styleHint.
\value StartDragVelocity (int) Velocity of a drag, overriding QPlatformIntegration::styleHint.
\value TextCursorWidth (int) Determines the width of the text cursor.
\value DropShadow (bool) Determines whether the drop shadow effect for tooltips or whatsthis is enabled.
\value MaximumScrollBarDragDistance (int) Determines the value returned by QStyle::pixelMetric(PM_MaximumDragDistance)
\value ToolButtonStyle (int) A value representing a Qt::ToolButtonStyle.
\value ToolBarIconSize Icon size for tool bars.
\value SystemIconThemeName (QString) Name of the icon theme.
\value SystemIconFallbackThemeName (QString) Name of the fallback icon theme.
\value IconThemeSearchPaths (QStringList) Search paths for icons.
\value ItemViewActivateItemOnSingleClick (bool) Activate items by single click.
\value StyleNames (QStringList) A list of preferred style names.
\value WindowAutoPlacement (bool) A boolean value indicating whether Windows (particularly dialogs) are placed by the system (see _NET_WM_FULL_PLACEMENT in X11).
\value DialogButtonBoxLayout (int) An integer representing a QDialogButtonBox::ButtonLayout value.
\value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether the buttons of a QDialogButtonBox should have icons.
\value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar.
\value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the keyboard scheme.
\value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations.
\value SpellCheckUnderlineStyle (int) A QTextCharFormat::UnderlineStyle specifying the underline style used misspelled words when spell checking.
\value TabFocusBehavior (int) A Qt::TabFocusBehavior specifying the behavior of focus change when tab key was pressed. This enum value was added in Qt 5.5.
\value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog becomes visible.
\value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release.
\value MenuSelectionWraps (bool) Determines whether menu selection wraps. That is, whether key navigation moves the selection to the first menu item again after the last menu item has been reached, and vice versa. This enum value was added in Qt 6.10.
\value TouchDoubleTapDistance (int) The maximum distance in logical pixels which a touchpoint can travel between taps in order for the tap sequence to be handled as a double tap. The default value is double the MouseDoubleClickDistance, or 10 logical pixels if that is not specified.
\value ShowShortcutsInContextMenus (bool) Whether to display shortcut key sequences in context menus.
\value InteractiveResizeAcrossScreens (bool) Whether using the whole virtual geometry of all the screens as basis for the resize. This enum value has been added in Qt 6.2.
\value ShowDirectoriesFirst (bool) Whether directories should be shown first (before files) in file dialogs. This enum value was added in Qt 6.3.
\value PreselectFirstFileInDirectory (bool) Whether the first file in a directory should be automatically selected when a file dialog opens. This enum value was added in Qt 6.3.
\value ButtonPressKeys (QList<Qt::Key>) A list of keys that can be used to press buttons via keyboard input.
\value SetFocusOnTouchRelease (bool) Whether focus objects (line edits etc) should receive input focus after a touch/mouse release. This enum value has been added in Qt 6.5.
\value MouseCursorTheme (QString) Name of the mouse cursor theme. This enum value has been added in Qt 6.5.
\value MouseCursorSize (QSize) Size of the mouse cursor. This enum value has been added in Qt 6.5.
\value ScrollSingleStepDistance (int) The distance in logical pixels that scrollable controls should scroll in response to a single step (e.g. scroll-bar arrow click, mouse wheel line).
Definition at line 51 of file qplatformtheme.h.
| Enumerator | |
|---|---|
| GeneralUiEffect | |
| AnimateMenuUiEffect | |
| FadeMenuUiEffect | |
| AnimateComboUiEffect | |
| AnimateTooltipUiEffect | |
| FadeTooltipUiEffect | |
| AnimateToolBoxUiEffect | |
| HoverEffect | |
Definition at line 273 of file qplatformtheme.h.
|
explicit |
Definition at line 449 of file qplatformtheme.cpp.
|
virtual |
Definition at line 459 of file qplatformtheme.cpp.
|
explicitprotected |
Definition at line 455 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGnomeTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QQuickControlsTestUtils::MockPlatformTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 476 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QIOSTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 491 of file qplatformtheme.cpp.
|
virtual |
Factory function for the QIconEngine used by QIcon::fromTheme().
By default this function returns a QIconLoaderEngine, but subclasses can reimplement it to provide their own.
It is especially useful to benefit from some platform specific facilities or optimizations like an inter-process cache in systems mostly built with Qt.
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QIOSTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 766 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGtk3Theme, QIOSTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 470 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QIOSTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 735 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 740 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QIOSTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 730 of file qplatformtheme.cpp.
|
virtual |
Factory function for QSystemTrayIcon.
This function will return 0 if the platform integration does not support creating any system tray icon.
Reimplemented in QCocoaTheme, and QXdgDesktopPortalTheme.
Definition at line 750 of file qplatformtheme.cpp.
|
static |
Definition at line 847 of file qplatformtheme.cpp.
Definition at line 608 of file qplatformtheme.cpp.
|
virtual |
Return an icon for fileInfo, observing iconOptions.
This function is queried by QFileIconProvider and similar classes to obtain an icon for a file. If it does not return a non-null icon, fileIconPixmap() is queried for a specific size.
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGnomeTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 552 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in OffscreenTheme, OffscreenTheme, QAndroidPlatformTheme, QCocoaTheme, QGenericUnixTheme, QGnomeTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 521 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QCocoaTheme, QIOSTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 496 of file qplatformtheme.cpp.
| QString QPlatformTheme::name | ( | ) | const |
Definition at line 944 of file qplatformtheme.cpp.
|
virtual |
Return a color palette for type type.
When relying on system color palette keep in mind that it is lazily initialized and cached. If it needs to be updated (i.e. due to ColorScheme changes), it's up to the caller to take care of it. See requestColorScheme.
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 510 of file qplatformtheme.cpp.
Definition at line 892 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGnomeTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QQuickControlsTestUtils::MockPlatformTheme, QWasmTheme, and QWindowsTheme.
Definition at line 481 of file qplatformtheme.cpp.
|
inlinevirtual |
Reimplemented in QAndroidPlatformTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 297 of file qplatformtheme.h.
|
virtual |
Returns the text of a standard button.
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGnomeTheme, and QXdgDesktopPortalTheme.
Definition at line 827 of file qplatformtheme.cpp.
|
virtual |
Return a pixmap for standardPixmap, at the given size.
The implementation should not take system DPR into account, and always return a pixmap with a DPR of 1. It's up to the consumer to account for DPR and request a pixmap of the right size.
Reimplemented in QCocoaTheme, QGtk3Theme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 534 of file qplatformtheme.cpp.
Reimplemented in OffscreenTheme, OffscreenTheme, QAndroidPlatformTheme, QCocoaTheme, QGenericUnixTheme, QGnomeTheme, QGtk3Theme, QIOSTheme, QKdeTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 560 of file qplatformtheme.cpp.
|
virtual |
Reimplemented in QAndroidPlatformTheme, QCocoaTheme, QGtk3Theme, QIOSTheme, QWasmTheme, QWindowsTheme, and QXdgDesktopPortalTheme.
Definition at line 464 of file qplatformtheme.cpp.
|
friend |
Definition at line 341 of file qplatformtheme.h.
|
protected |
Definition at line 338 of file qplatformtheme.h.