Slate.TooltipSummonDelay
Slate.TooltipSummonDelay
#Overview
name: Slate.TooltipSummonDelay
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Delay in seconds before a tooltip is displayed near the mouse cursor when hovering over widgets that supply tooltip data.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.TooltipSummonDelay is to control the delay in seconds before a tooltip is displayed near the mouse cursor when hovering over widgets that supply tooltip data in the Slate UI framework of Unreal Engine 5.
This setting variable is primarily used in the Slate subsystem, which is responsible for the user interface framework in Unreal Engine. Based on the callsites, it’s specifically used in the SlateUser module, which handles user interaction with the UI.
The value of this variable is set as a console variable using FAutoConsoleVariableRef. It’s initialized with a default value of 0.15 seconds but can be changed at runtime through the console or configuration files.
Slate.TooltipSummonDelay interacts closely with another variable called TooltipSummonDelay. They share the same value, with Slate.TooltipSummonDelay being the console variable name and TooltipSummonDelay being the actual C++ variable used in the code.
Developers should be aware that this variable affects the user experience of the UI. A longer delay might make the interface feel less responsive, while a shorter delay could lead to tooltips appearing too quickly, potentially becoming distracting.
Best practices when using this variable include:
- Keeping the delay short enough to be responsive but long enough to prevent accidental tooltip displays.
- Considering accessibility needs - some users might benefit from longer or shorter delays.
- Testing different values to find the optimal balance for your specific application.
Regarding the associated variable TooltipSummonDelay:
The purpose of TooltipSummonDelay is to store the actual delay value used in the code for summoning tooltips. It’s the C++ variable that directly controls the tooltip delay in the Slate system.
This variable is used in the SlateUser module, specifically in the UpdateTooltip function of the FSlateUser class. It’s used to calculate the time since the tooltip was summoned, which in turn affects the tooltip’s opacity during its introduction animation.
The value of TooltipSummonDelay is set through the Slate.TooltipSummonDelay console variable. Any changes to the console variable will be reflected in TooltipSummonDelay.
TooltipSummonDelay interacts with other variables in the tooltip system, such as TooltipIntroDuration, which controls the duration of the tooltip’s fade-in animation.
Developers should be aware that changes to TooltipSummonDelay will directly affect the behavior of tooltips in their application. It’s used in time calculations, so very small or very large values could lead to unexpected behavior.
Best practices for using TooltipSummonDelay include:
- Ensuring it’s properly synchronized with Slate.TooltipSummonDelay if you’re modifying it directly.
- Considering its impact on the overall feel of the UI when adjusting related variables like TooltipIntroDuration.
- Using it in conjunction with other tooltip-related variables to create a smooth and intuitive tooltip experience.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:46
Scope: file
Source code excerpt:
static float TooltipSummonDelay = 0.15f;
FAutoConsoleVariableRef CVarTooltipSummonDelay(
TEXT("Slate.TooltipSummonDelay"),
TooltipSummonDelay,
TEXT("Delay in seconds before a tooltip is displayed near the mouse cursor when hovering over widgets that supply tooltip data."));
static float TooltipIntroDuration = 0.1f;
FAutoConsoleVariableRef CVarTooltipIntroDuration(
TEXT("Slate.TooltipIntroDuration"),
#Associated Variable and Callsites
This variable is associated with another variable named TooltipSummonDelay
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:44
Scope: file
Source code excerpt:
TEXT("Scale factor applied to the software cursor. Requires the cursor widget to be scale-aware."));
static float TooltipSummonDelay = 0.15f;
FAutoConsoleVariableRef CVarTooltipSummonDelay(
TEXT("Slate.TooltipSummonDelay"),
TooltipSummonDelay,
TEXT("Delay in seconds before a tooltip is displayed near the mouse cursor when hovering over widgets that supply tooltip data."));
static float TooltipIntroDuration = 0.1f;
FAutoConsoleVariableRef CVarTooltipIntroDuration(
TEXT("Slate.TooltipIntroDuration"),
TooltipIntroDuration,
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:1390
Scope (from outer to inner):
file
function void FSlateUser::UpdateTooltip
Source code excerpt:
// How long since the tooltip was summoned?
const double PlatformSeconds = FPlatformTime::Seconds();
const float TimeSinceSummon = (float)(PlatformSeconds - TooltipSummonDelay - ActiveTooltipInfo.SummonTime);
const float TooltipOpacity = FMath::Clamp<float>(TimeSinceSummon / TooltipIntroDuration, 0.0f, 1.0f);
// Update window opacity
TSharedRef<SWindow> TooltipWindow = TooltipWindowPtr.Pin().ToSharedRef();
TooltipWindow->SetOpacity(TooltipOpacity);