gpt4 book ai didi

c++ - Windows 中的 QSystemTrayIcon 工具提示最大长度是多少?

转载 作者:可可西里 更新时间:2023-11-01 09:27:49 25 4
gpt4 key购买 nike

我阅读了 QSystemTrayIcon::toolTip 的 Qt 5.8 文档那:

This property holds the tooltip for the system tray entry.

On some systems, the tooltip's length is limited. The tooltip will be truncated if necessary.

那我想知道Windows 10的限制是什么。

我在 About Tooltip Controls 中看到那个

Note The maximum length for standard tooltip text is 80 characters. For more information, see the NMTTDISPINFO structure. Multiline tooltip text can be longer.

然后,我使用 Qt 创建了一个多行工具提示,我看到在 Windows 10 中最大长度为 123 个字符(如果算上换行符,可能会更长一些,比如 ~130)。

我的问题是:这(~130 个字符)是 Windows 10 中多行工具提示的最大长度吗?我能否根据系统从 Qt 获取此信息(如果应用程序在不同的操作系统上运行),以便我可以正确更改工具提示文本?

谢谢大家

最佳答案

在 Windows 2000 及更高版本上,工具提示的最大长度为 128 个字符。这在 MSDN 中记录为 NOTIFYICONDATA structure :

szTip

Type: TCHAR[64]

A null-terminated string that specifies the text for a standard tooltip. It can have a maximum of 64 characters, including the terminating null character.

For Windows 2000 and later, szTip can have a maximum of 128 characters, including the terminating null character.

关于可移植性,这是一个非常特定于系统的值,所以我认为您无法使用普通 Qt 获得它。例如,Linux 中不同的窗口管理器可能有不同的长度限制。


另一方面,为了完整起见,系统托盘气球中的文本长度更大(仅限 Windows 2000 及更高版本,取自同一来源):

szInfo

Type: TCHAR[256]

Windows 2000 and later. A null-terminated string that specifies the text to display in a balloon notification. It can have a maximum of 256 characters, including the terminating null character, but should be restricted to 200 characters in English to accommodate localization. To remove the balloon notification from the UI, either delete the icon (with NIM_DELETE) or set the NIF_INFO flag in uFlags and set szInfo to an empty string.

同样,标题的长度是:

szInfoTitle

Type: TCHAR[64]

Windows 2000 and later. A null-terminated string that specifies a title for a balloon notification. This title appears in a larger font immediately above the text. It can have a maximum of 64 characters, including the terminating null character, but should be restricted to 48 characters in English to accommodate localization.

dwInfoFlags

Type: DWORD

Windows 2000 and later. Flags that can be set to modify the behavior and appearance of a balloon notification. The icon is placed to the left of the title. If the szInfoTitle member is zero-length, the icon is not shown.

关于c++ - Windows 中的 QSystemTrayIcon 工具提示最大长度是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44065248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com