有没有办法使等离子工具提示以编程方式显示/隐藏?
我尝试在ToolTipArea
紧凑表示上设置 a ,并尝试用 a 触发它Timer
- 它不起作用(常规工具提示不断显示,但仅在悬停于等离子图标(又名compactRepresentation
)时:
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
Layout.preferredWidth: 200
Layout.preferredHeight: 300
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
Plasmoid.compactRepresentation: Item
{
anchors.fill: parent
MouseArea
{
onClicked:
{
plasmoid.expanded = !plasmoid.expanded
}
}
PlasmaCore.ToolTipArea
{
id: toolTip
width: parent.width
height: parent.height
anchors.fill: parent
mainItem: tooltipContentItem
active: false
interactive: true
}
Timer
{
interval: 3000 …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将哈希值传递给 URL 以设置 UIkit 过滤器。
<div uk-filter="target:.js-filter">
<ul>
<li class="uk-active" uk-filter-control><a href="#">All</a></li>
<li uk-filter-control="filter:[data-color='blue'];"><a href="#"></a></li>
<li uk-filter-control="filter:[data-color='white'];"><a href="#"></a></li>
</ul>
<ul class="js-filter">
<li data-color="blue"></li>
<li data-color="white"></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
因此,例如,如果我访问http://example.com/#white,该内容仅显示白色项目(并且“白色”过滤器控件处于活动状态)。
我找不到任何关于如何使用 UIkit 3 实现这一目标的明确示例(这是关于 UIkit 2 的)。对于像我这样的菜鸟来说,文档似乎不清楚,因为不清楚target
和selActive
选项所指的是什么。但是,我正在尝试以下操作:
<script>
document.addEventListener("DOMContentLoaded", function(event){
hash = document.location.hash;
console.log("Hash: " + hash);
if ( hash !== "" ) {
var filter = document.querySelector('.js-filter');
UIkit.filter( filter, {
target: 'li [data-color:' + hash + ']',
selActive: true,
});
} …
Run Code Online (Sandbox Code Playgroud)