Slate.EnableTooltips

Slate.EnableTooltips

#Overview

name: Slate.EnableTooltips

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Slate.EnableTooltips is to control whether tooltips are allowed to spawn in the Slate UI system of Unreal Engine 5. This setting variable is primarily used for the user interface and interaction systems within the engine.

The Slate subsystem, which is part of Unreal Engine’s UI framework, relies on this setting variable. It’s particularly used in the SlateApplication module, which handles the core functionality of the Slate UI system.

The value of this variable is set through a console variable (CVar) named “Slate.EnableTooltips”. It’s initialized in the SlateApplication.cpp file, with a default value that depends on the platform. For platforms that need UI tooltips, it’s set to true by default; otherwise, it’s set to false.

The associated variable bEnableTooltips interacts closely with Slate.EnableTooltips. They share the same value, and bEnableTooltips is used directly in the code to determine whether tooltips should be displayed.

Developers must be aware that this variable affects the entire Slate UI system. Disabling tooltips will prevent them from appearing anywhere in the engine or game UI that uses Slate. This could impact user experience and usability, especially for new users or complex interfaces.

Best practices when using this variable include:

  1. Consider leaving tooltips enabled for most development and user-facing scenarios to aid in UI discoverability and usability.
  2. Use the SetAllowTooltips() and GetAllowTooltips() methods of FSlateApplication for runtime control of tooltip visibility rather than directly modifying the CVar.
  3. Be consistent in your use of tooltips across your project if you choose to enable them.

Regarding the associated variable bEnableTooltips:

The purpose of bEnableTooltips is to store and provide quick access to the tooltip enable/disable state within the Slate system.

It’s used directly in the SlateApplication module to determine whether tooltips should be displayed. The FSlateApplication class provides methods SetAllowTooltips() and GetAllowTooltips() that directly interact with this variable.

The value of bEnableTooltips is set in multiple places:

  1. It’s initialized based on the platform in SlateApplication.cpp.
  2. It can be modified through the Slate.EnableTooltips console variable.
  3. It can be changed at runtime using the SetAllowTooltips() method.

Developers should be aware that changes to bEnableTooltips will immediately affect tooltip visibility across the entire Slate UI system. It’s a global setting that impacts all Slate-based UIs.

Best practices for bEnableTooltips include:

  1. Use the provided FSlateApplication methods to modify this value rather than changing it directly.
  2. Consider the impact on user experience when disabling tooltips, especially for complex UIs or tools.
  3. If you need more granular control over tooltip visibility, consider implementing additional logic at the widget level rather than relying solely on this global setting.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:586

Scope: file

Source code excerpt:

#endif
FAutoConsoleVariableRef CVarEnableTooltips(
	TEXT("Slate.EnableTooltips"),
	bEnableTooltips,
	TEXT("Whether to allow tooltips to spawn at all."));

#if !UE_BUILD_SHIPPING

static void HandleGlobalInvalidateCVarTriggered(const TArray<FString>& Args)

#Loc: <Workspace>/Engine/Source/Developer/SlateReflector/Private/Widgets/SSlateOptions.cpp:59

Scope (from outer to inner):

file
function     void SSlateOptions::Construct
function     static TSharedRef<SWidget> FillToolbar

Source code excerpt:


			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("EnableFastWidgetPath", "Fast Widget Path"), TEXT("Slate.EnableFastWidgetPath"), false);
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("EnableToolTips", "Enable Tooltips"), TEXT("Slate.EnableTooltips"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("GlobalInvalidation", "Global Invalidation"), TEXT("Slate.EnableGlobalInvalidation"));
			AddMenuEntry(MenuBuilder, Icon, LOCTEXT("DisabledEffect", "Transparent Disabled Effect"), TEXT("Slate.ApplyDisabledEffectOnWidgets"));

			return MenuBuilder.MakeWidget();
		}
	};

#Associated Variable and Callsites

This variable is associated with another variable named bEnableTooltips. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Experimental/VirtualScouting/Source/VirtualScouting/Public/VirtualScoutingSettings.h:58

Scope (from outer to inner):

file
class        class UVirtualScoutingEditorSettings : public UObject

Source code excerpt:


	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category="Virtual Scouting User", meta=(DisplayName= "Show Tooltips", ToolTip="Show Tooltips when in VR. These appear when motioncontroller is brought near to HMD"));
	bool bEnableTooltips = true;

	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category="Virtual Scouting User", meta=(DisplayName= "Use Smooth Rotation", ToolTip="True = Rotate smoothly. False = Flick Rotate. Default is Flick Rotate"));
	bool bUseSmoothRotation = false;

	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category="Virtual Scouting User", meta=(DisplayName= "Use Teleport Rotation", ToolTip="Use the forward axis roll from the motion controller to define and adjust teleport rotation"));
	bool bUseTeleportRotation = false;

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:581

Scope: file

Source code excerpt:


#if PLATFORM_UI_NEEDS_TOOLTIPS
static bool bEnableTooltips = true;
#else
static bool bEnableTooltips = false;
#endif
FAutoConsoleVariableRef CVarEnableTooltips(
	TEXT("Slate.EnableTooltips"),
	bEnableTooltips,
	TEXT("Whether to allow tooltips to spawn at all."));

#if !UE_BUILD_SHIPPING

static void HandleGlobalInvalidateCVarTriggered(const TArray<FString>& Args)
{

#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:3887

Scope (from outer to inner):

file
function     void FSlateApplication::SetAllowTooltips

Source code excerpt:

void FSlateApplication::SetAllowTooltips(bool bCanShow)
{
	bEnableTooltips = bCanShow;
}

bool FSlateApplication::GetAllowTooltips() const
{
	return bEnableTooltips;
}

UE::Slate::FDeprecateVector2DResult FSlateApplication::CalculateTooltipWindowPosition( const FSlateRect& InAnchorRect, const UE::Slate::FDeprecateVector2DParameter& InSize, bool bAutoAdjustForDPIScale) const
{
	// first use the CalculatePopupWindowPosition and if cursor is not inside it, proceed with it to avoid behavior change.
	FVector2f PopupPosition = CalculatePopupWindowPosition(InAnchorRect, InSize, bAutoAdjustForDPIScale);