在使用 QWebEngineView::setHtml
时显示本地 Html 文件,我注意到工具提示的文本是自动换行的。我试图修改 CSS 以禁用自动换行,但它不起作用。在 Chrome 上我没有这个问题。
[编辑]
尝试运行 this Chrome 中的简单 HTML 示例,然后使用 QWebEngineView,您将看到不同之处。当您将鼠标悬停在 <p>
上时QWebEngineView 中的元素,您会看到工具提示被包装,这与 Chrome 不同。
下面是一些截图:
QWebEngineView :
Chrome:
这是 Html:
<div id="fullSc" class="fullScCls" title="FullScreen (Alt + F11)" onclick="fullSc(this);"><span></span></div>
这是 CSS :
.fullScCls {
width:32px;
height:32px;
color:#fff;
font-size:18pt;
font-family: IconFont;
cursor:pointer;
white-space:pre; // I tried this because it works with QTooltip (rich text)
// even if it will affect the div content only, and not its tooltip I think
}
.fullScCls:hover{
color:#42AECC;
transition: .5s;
}
最佳答案
请打破 html 中的文本的样子。
title="FullScreen
( Alt + F11)"
Codepen: https://codepen.io/tushar-kumawat/pen/KrROjJ
关于html - 如何在 QWebEngineView 中禁用工具提示(标题)的自动换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53463415/