QPlatformTheme Class

The QPlatformTheme class allows customizing the UI based on themes. More...

Header: #include <QPlatformTheme>
Inherited By:

QGnomeTheme and QKdeTheme

Public Types

flags IconOptions
enum ThemeHint { CursorFlashTime, KeyboardInputInterval, MouseDoubleClickInterval, MouseDoubleClickDistance, MousePressAndHoldInterval, …, MouseCursorSize }

Public Functions

virtual QIconEngine *createIconEngine(const QString &iconName) const
virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const
virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = ...) const
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const
virtual QKeySequence standardButtonShortcut(int button) const
virtual QString standardButtonText(int button) const

Detailed Description

\since5.0 \internal \preliminary \ingroup qpa

See the init_platform function in qguiapplication.cpp for the complete platform initialization process.

Member Type Documentation

enum QPlatformTheme::ThemeHint

This enum describes the available theme hints.

ConstantValueDescription
QPlatformTheme::CursorFlashTime0(int) Cursor flash time in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::KeyboardInputInterval1(int) Keyboard input interval in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::MouseDoubleClickInterval2(int) Mouse double click interval in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::MouseDoubleClickDistance31(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.
QPlatformTheme::MousePressAndHoldInterval30(int) Mouse press and hold interval in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::StartDragDistance3(int) Start drag distance, overriding QPlatformIntegration::styleHint.
QPlatformTheme::StartDragTime4(int) Start drag time in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::WheelScrollLines32(int) The number of lines to scroll a widget, when the mouse wheel is rotated. The default value is 3.
QPlatformTheme::KeyboardAutoRepeatRate5(int) Keyboard auto repeat rate, overriding QPlatformIntegration::styleHint.
QPlatformTheme::PasswordMaskDelay6(int) Pass word mask delay in ms, overriding QPlatformIntegration::styleHint.
QPlatformTheme::StartDragVelocity7(int) Velocity of a drag, overriding QPlatformIntegration::styleHint.
QPlatformTheme::TextCursorWidth8(int) Determines the width of the text cursor.
QPlatformTheme::DropShadow9(bool) Determines whether the drop shadow effect for tooltips or whatsthis is enabled.
QPlatformTheme::MaximumScrollBarDragDistance10(int) Determines the value returned by QStyle::pixelMetric(PM_MaximumDragDistance)
QPlatformTheme::ToolButtonStyle11(int) A value representing a Qt::ToolButtonStyle.
QPlatformTheme::ToolBarIconSize12Icon size for tool bars.
QPlatformTheme::SystemIconThemeName14(QString) Name of the icon theme.
QPlatformTheme::SystemIconFallbackThemeName15(QString) Name of the fallback icon theme.
QPlatformTheme::IconThemeSearchPaths16(QStringList) Search paths for icons.
QPlatformTheme::ItemViewActivateItemOnSingleClick13(bool) Activate items by single click.
QPlatformTheme::StyleNames17(QStringList) A list of preferred style names.
QPlatformTheme::WindowAutoPlacement18(bool) A boolean value indicating whether Windows (particularly dialogs) are placed by the system (see _NET_WM_FULL_PLACEMENT in X11).
QPlatformTheme::DialogButtonBoxLayout19(int) An integer representing a QDialogButtonBox::ButtonLayout value.
QPlatformTheme::DialogButtonBoxButtonsHaveIcons20(bool) A boolean value indicating whether the buttons of a QDialogButtonBox should have icons.
QPlatformTheme::UseFullScreenForPopupMenu21(bool) Pop menus can cover the full screen including task bar.
QPlatformTheme::KeyboardScheme22(int) An integer value (enum KeyboardSchemes) specifying the keyboard scheme.
QPlatformTheme::UiEffects23(int) A flag value consisting of UiEffect values specifying the enabled UI animations.
QPlatformTheme::SpellCheckUnderlineStyle24(int) A QTextCharFormat::UnderlineStyle specifying the underline style used misspelled words when spell checking.
QPlatformTheme::TabFocusBehavior25(int) A Qt::TabFocusBehavior specifying the behavior of focus change when tab key was pressed. This enum value was added in Qt 5.5.
QPlatformTheme::DialogSnapToDefaultButton28(bool) Whether the mouse should snap to the default button when a dialog becomes visible.
QPlatformTheme::ContextMenuOnMouseRelease29(bool) Whether the context menu should be shown on mouse release.
QPlatformTheme::TouchDoubleTapDistance33(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.
QPlatformTheme::ShowShortcutsInContextMenus34(bool) Whether to display shortcut key sequences in context menus.
QPlatformTheme::InteractiveResizeAcrossScreens37(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.
QPlatformTheme::ShowDirectoriesFirst38(bool) Whether directories should be shown first (before files) in file dialogs. This enum value was added in Qt 6.3.
QPlatformTheme::PreselectFirstFileInDirectory39(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.
QPlatformTheme::ButtonPressKeys40(QList<Qt::Key>) A list of keys that can be used to press buttons via keyboard input.
QPlatformTheme::SetFocusOnTouchRelease41(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.
QPlatformTheme::MouseCursorTheme46(QString) Name of the mouse cursor theme. This enum value has been added in Qt 6.5.
QPlatformTheme::MouseCursorSize47(QSize) Size of the mouse cursor. This enum value has been added in Qt 6.5.

See also QApplication::wheelScrollLines(), themeHint(), and QStyle::pixelMetric().

Member Function Documentation

[virtual] QIconEngine *QPlatformTheme::createIconEngine(const QString &iconName) const

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.

\since5.1

[virtual] QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const

Factory function for QSystemTrayIcon. This function will return 0 if the platform integration does not support creating any system tray icon.

[virtual] QIcon QPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = ...) const

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.

\since5.8

[virtual] QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) const

Returns the key sequence that should be used for a standard action.

\since5.2

[virtual] QKeySequence QPlatformTheme::standardButtonShortcut(int button) const

Returns the mnemonic that should be used for a standard button.

\since5.9

See also QPlatformDialogHelper::StandardButton.

[virtual] QString QPlatformTheme::standardButtonText(int button) const

Returns the text of a standard button.

\since5.3

See also QPlatformDialogHelper::StandardButton.