Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

LinkButton

Inherits: BaseButton < Control < CanvasItem < Node < Object

代表链接的按钮。

Description

代表链接的按钮。这种按钮主要用于与按钮的交互引起上下文变化时(如链接到网页)。

另见 BaseButton,它包含了该节点相关的常用属性和方法。

Properties

FocusMode

focus_mode

0 (overrides Control)

String

language

""

CursorShape

mouse_default_cursor_shape

2 (overrides Control)

StructuredTextParser

structured_text_bidi_override

0

Array

structured_text_bidi_override_options

[]

String

text

""

TextDirection

text_direction

0

UnderlineMode

underline

0

String

uri

""

Theme Properties

Color

font_color

Color(0.875, 0.875, 0.875, 1)

Color

font_focus_color

Color(0.95, 0.95, 0.95, 1)

Color

font_hover_color

Color(0.95, 0.95, 0.95, 1)

Color

font_outline_color

Color(1, 1, 1, 1)

Color

font_pressed_color

Color(1, 1, 1, 1)

int

outline_size

0

int

underline_spacing

2

Font

font

int

font_size

StyleBox

focus


Enumerations

enum UnderlineMode:

UnderlineMode UNDERLINE_MODE_ALWAYS = 0

LinkButton 将始终在其文本底部显示下划线。

UnderlineMode UNDERLINE_MODE_ON_HOVER = 1

LinkButton 将在鼠标光标悬停时,在文本底部显示下划线。

UnderlineMode UNDERLINE_MODE_NEVER = 2

LinkButton 永远不会在其文本底部显示下划线。


Property Descriptions

String language = ""

  • void set_language ( String value )

  • String get_language ( )

语言代码,用于断行和文本塑形算法,如果留空则使用当前区域设置。


StructuredTextParser structured_text_bidi_override = 0

为结构化文本设置 BiDi 算法覆盖。


Array structured_text_bidi_override_options = []

  • void set_structured_text_bidi_override_options ( Array value )

  • Array get_structured_text_bidi_override_options ( )

设置 BiDi 覆盖的附加选项。


String text = ""

该按钮的文本,将显示在按钮的区域内。


TextDirection text_direction = 0

基础文本书写方向。


UnderlineMode underline = 0

文本的下划线模式。可用模式见 UnderlineMode


String uri = ""

这个 LinkButtonURI。如果设置为有效的 URI,按下按钮就会使用操作系统中与该协议对应的默认程序打开该 URI(使用 OS.shell_open)。HTTP 和 HTTPS 的 URL 会打开默认的浏览器。

示例:

uri = "https://godotengine.org"  # 在默认浏览器中打开 URL。
uri = "C:\SomeFolder"  # 将文件浏览器打开到给定的路径。
uri = "C:\SomeImage.png"  # 在默认查看应用中打开给定的图像。