QStyleHints Class

The QStyleHints class contains platform specific hints and settings. More...

Header: #include <QStyleHints>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Inherits: QObject

Properties

Public Functions

Qt::ColorScheme colorScheme() const
int cursorFlashTime() const
qreal fontSmoothingGamma() const
qreal keyboardAutoRepeatRateF() const
int keyboardInputInterval() const
int mouseDoubleClickDistance() const
int mouseDoubleClickInterval() const
int mousePressAndHoldInterval() const
int mouseQuickSelectionThreshold() const
QChar passwordMaskCharacter() const
int passwordMaskDelay() const
bool setFocusOnTouchRelease() const
void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus)
void setUseHoverEffects(bool useHoverEffects)
bool showIsFullScreen() const
bool showIsMaximized() const
bool showShortcutsInContextMenus() const
bool singleClickActivation() const
int startDragDistance() const
int startDragTime() const
int startDragVelocity() const
Qt::TabFocusBehavior tabFocusBehavior() const
int touchDoubleTapDistance() const
bool useHoverEffects() const
bool useRtlExtensions() const
int wheelScrollLines() const

Signals

void colorSchemeChanged(Qt::ColorScheme colorScheme)
void cursorFlashTimeChanged(int cursorFlashTime)
void keyboardInputIntervalChanged(int keyboardInputInterval)
void mouseDoubleClickIntervalChanged(int mouseDoubleClickInterval)
void mousePressAndHoldIntervalChanged(int mousePressAndHoldInterval)
void mouseQuickSelectionThresholdChanged(int threshold)
void showShortcutsInContextMenusChanged(bool)
void startDragDistanceChanged(int startDragDistance)
void startDragTimeChanged(int startDragTime)
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior)
void useHoverEffectsChanged(bool useHoverEffects)
void wheelScrollLinesChanged(int scrollLines)

Detailed Description

An object of this class, obtained from QGuiApplication, provides access to certain global user interface parameters of the current platform.

Access to most settings is read only. The platform itself usually provides the user with ways to tune these parameters. Authors of custom user interface components should read relevant settings to allow the components to exhibit the same behavior and feel as other components.

See also QGuiApplication::styleHints().

Property Documentation

[read-only, since 6.5] colorScheme : const Qt::ColorScheme

This property holds the color scheme of the platform theme.

This property was introduced in Qt 6.5.

Access functions:

Qt::ColorScheme colorScheme() const

Notifier signal:

void colorSchemeChanged(Qt::ColorScheme colorScheme)

See also Qt::ColorScheme.

[read-only] cursorFlashTime : const int

This property holds the text cursor's flash (blink) time in milliseconds.

The flash time is the time used to display, invert and restore the caret display. Usually the text cursor is displayed for half the cursor flash time, then hidden for the same amount of time.

Access functions:

int cursorFlashTime() const

Notifier signal:

void cursorFlashTimeChanged(int cursorFlashTime)

[read-only] fontSmoothingGamma : const qreal

This property holds the gamma value used in font smoothing.

Access functions:

qreal fontSmoothingGamma() const

[read-only, since 6.5] keyboardAutoRepeatRateF : const qreal

This property holds the rate, in events per second, in which additional repeated key presses will automatically be generated if a key is being held down.

This property was introduced in Qt 6.5.

Access functions:

qreal keyboardAutoRepeatRateF() const

[read-only] keyboardInputInterval : const int

This property holds the time limit, in milliseconds, that distinguishes a key press from two consecutive key presses.

Access functions:

int keyboardInputInterval() const

Notifier signal:

void keyboardInputIntervalChanged(int keyboardInputInterval)

[read-only] mouseDoubleClickDistance : const int

This property holds the maximum distance, in pixels, that the mouse can be moved between two consecutive mouse clicks and still have it detected as a double-click

Access functions:

int mouseDoubleClickDistance() const

[read-only] mouseDoubleClickInterval : const int

This property holds the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks.

Access functions:

int mouseDoubleClickInterval() const

Notifier signal:

void mouseDoubleClickIntervalChanged(int mouseDoubleClickInterval)

[read-only] mousePressAndHoldInterval : const int

This property holds the time limit in milliseconds that activates a press and hold.

Access functions:

int mousePressAndHoldInterval() const

Notifier signal:

void mousePressAndHoldIntervalChanged(int mousePressAndHoldInterval)

mouseQuickSelectionThreshold : const int

Quick selection mouse threshold in QLineEdit.

This property defines how much the mouse cursor should be moved along the y axis to trigger a quick selection during a normal QLineEdit text selection.

If the property value is less than or equal to 0, the quick selection feature is disabled.

Access functions:

int mouseQuickSelectionThreshold() const

Notifier signal:

void mouseQuickSelectionThresholdChanged(int threshold)

[read-only] passwordMaskCharacter : const QChar

This property holds the character used to mask the characters typed into text input fields in password mode.

Access functions:

QChar passwordMaskCharacter() const

[read-only] passwordMaskDelay : const int

This property holds the time, in milliseconds, a typed letter is displayed unshrouded in a text input field in password mode.

Access functions:

int passwordMaskDelay() const

[read-only] setFocusOnTouchRelease : const bool

This property holds the event that should set input focus on focus objects.

This property is true if focus objects (line edits etc) should receive input focus after a touch/mouse release. This is normal behavior on touch platforms. On desktop platforms, the standard is to set focus already on touch/mouse press.

Access functions:

bool setFocusOnTouchRelease() const

[read-only] showIsFullScreen : const bool

This property holds whether the platform defaults to fullscreen windows.

This property is true if the platform defaults to windows being fullscreen, otherwise false.

Note: The platform may still choose to show certain windows non-fullscreen, such as popups or dialogs. This property only reports the default behavior.

Access functions:

bool showIsFullScreen() const

See also QWindow::show() and showIsMaximized().

[read-only] showIsMaximized : const bool

This property holds whether the platform defaults to maximized windows.

This property is true if the platform defaults to windows being maximized, otherwise false.

Note: The platform may still choose to show certain windows non-maximized, such as popups or dialogs. This property only reports the default behavior.

Access functions:

bool showIsMaximized() const

See also QWindow::show() and showIsFullScreen().

showShortcutsInContextMenus : bool

true if the platform normally shows shortcut key sequences in context menus, otherwise false.

Since Qt 5.13, the setShowShortcutsInContextMenus() function can be used to override the platform default.

Access functions:

bool showShortcutsInContextMenus() const
void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus)

Notifier signal:

void showShortcutsInContextMenusChanged(bool)

See also Qt::AA_DontShowShortcutsInContextMenus.

[read-only] singleClickActivation : const bool

This property holds whether items are activated by single or double click.

This property is true if items should be activated by single click, false if they should be activated by double click instead.

Access functions:

bool singleClickActivation() const

[read-only] startDragDistance : const int

This property holds the distance, in pixels, that the mouse must be moved with a button held down before a drag and drop operation will begin.

If you support drag and drop in your application, and want to start a drag and drop operation after the user has moved the cursor a certain distance with a button held down, you should use this property's value as the minimum distance required.

For example, if the mouse position of the click is stored in startPos and the current position (e.g. in the mouse move event) is currentPos, you can find out if a drag should be started with code like this:

if ((startPos - currentPos).manhattanLength() >=
        QApplication::startDragDistance())
    startTheDrag();

Access functions:

int startDragDistance() const

Notifier signal:

void startDragDistanceChanged(int startDragDistance)

See also startDragTime, QPoint::manhattanLength(), and Drag and Drop.

[read-only] startDragTime : const int

This property holds the time, in milliseconds, that a mouse button must be held down before a drag and drop operation will begin.

If you support drag and drop in your application, and want to start a drag and drop operation after the user has held down a mouse button for a certain amount of time, you should use this property's value as the delay.

Access functions:

int startDragTime() const

Notifier signal:

void startDragTimeChanged(int startDragTime)

See also startDragDistance and Drag and Drop.

[read-only] startDragVelocity : const int

This property holds the limit for the velocity, in pixels per second, that the mouse may be moved, with a button held down, for a drag and drop operation to begin. A value of 0 means there is no such limit.

Access functions:

int startDragVelocity() const

See also startDragDistance and Drag and Drop.

[read-only] tabFocusBehavior : const Qt::TabFocusBehavior

This property holds the focus behavior on press of the tab key.

Note: Do not bind this value in QML because the change notifier signal is not implemented yet.

Access functions:

Qt::TabFocusBehavior tabFocusBehavior() const

Notifier signal:

void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior)

[read-only] touchDoubleTapDistance : const int

This property holds the maximum distance, in pixels, that a finger can be moved between two consecutive taps and still have it detected as a double-tap

Access functions:

int touchDoubleTapDistance() const

useHoverEffects : bool

This property holds whether UI elements use hover effects.

This property is true if UI elements should use hover effects. This is the standard behavior on desktop platforms with a mouse pointer, whereas on touch platforms the overhead of hover event delivery can be avoided.

Access functions:

bool useHoverEffects() const
void setUseHoverEffects(bool useHoverEffects)

Notifier signal:

void useHoverEffectsChanged(bool useHoverEffects)

[read-only] useRtlExtensions : const bool

This property holds the writing direction.

This property is true if right-to-left writing direction is enabled, otherwise false.

Access functions:

bool useRtlExtensions() const

[read-only] wheelScrollLines : const int

Number of lines to scroll by default for each wheel click.

Access functions:

int wheelScrollLines() const

Notifier signal:

void wheelScrollLinesChanged(int scrollLines)

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.